*Update: It seems to be an issue with CFB mode. If I switch to ECB: 12 ms to process the workload.*
in encrypt aes Encrypted 1at: 05/12/2023 17:06:54.838 Encrypted 2at: 05/12/2023 17:06:54.838 Encrypted 3at: 05/12/2023 17:06:54.838 returning cipher Encrypted 4at: 05/12/2023 17:06:54.850 std::string encrypt_aes(std::string message, SecByteBlock key, SecByteBlock iv) { try { cout <<" in encrypt aes " <<endl; cout << " Encrypted 1at: " << get_curr_datetime_str() << endl; AlgorithmParameters params = MakeParameters(Name::FeedbackSize(), 1 /*8-bits*/) (Name::IV(), ConstByteArrayParameter(iv)); cout << " Encrypted 2at: " << get_curr_datetime_str() << endl; ECB_Mode<AES>::Encryption e; std::string cipher; cipher.reserve(message.size()+16); e.SetKey(key, key.size(), params); cout << " Encrypted 3at: " << get_curr_datetime_str() << endl; /* const size_t buf_sz = 320000; byte buffer[buf_sz]; StringSink ssk(cipher); ArraySource ars((const byte*)message.data(), message.size(), true, new StreamTransformationFilter(e, new ArraySink(buffer,buf_sz))); while(true){ size_t bread = ars.Get(buffer, buf_sz); if(bread==0){ break; } ssk.Put(buffer,bread); } ssk.MessageEnd(); */ StringSource ss(message, true, new StreamTransformationFilter(e, new StringSink(cipher))); cout << " returning cipher " << endl; cout << " Encrypted 4at: " << get_curr_datetime_str() << endl; return cipher; } catch (CryptoPP::Exception e) { std::cerr << e.what() << std::endl; return ""; } } On Friday, May 12, 2023 at 11:46:08 AM UTC-4 Dwight Kulkarni wrote: > Hi Jeff, > > The time is taken up all on the one line: > > > StringSource ss(message, true, new StreamTransformationFilter(e, new > StringSink(cipher))); > > > *Do you know what might be the difference versus the .exe test ? > <TR><TD>AES/CFB (128-bit key)<TD>ARMv8<TD>344<TD>4.99<TD>1.135<TD>2044* > > > > Encrypted 1at: 05/12/2023 15:40:55.588 > Encrypted 2at: 05/12/2023 15:40:55.588 > Encrypted 3at: 05/12/2023 15:40:55.588 > returning cipher > Encrypted 4at: 05/12/2023 15:40:56.599 > Encrypted at: 05/12/2023 15:40:56.600 > > > std::string encrypt_aes(std::string message, SecByteBlock key, > SecByteBlock iv) { > try { > cout <<" in encrypt aes " <<endl; > cout << " Encrypted 1at: " << get_curr_datetime_str() << endl; > AlgorithmParameters params = MakeParameters(Name::FeedbackSize(), 1 > /*8-bits*/) > (Name::IV(), ConstByteArrayParameter(iv)); > cout << " Encrypted 2at: " << get_curr_datetime_str() << endl; > CFB_Mode<AES>::Encryption e; > std::string cipher; > cipher.reserve(message.size()+16); > e.SetKey(key, key.size(), params); > cout << " Encrypted 3at: " << get_curr_datetime_str() << endl; > StringSource ss(message, true, new StreamTransformationFilter(e, new > StringSink(cipher))); > cout << " returning cipher " << endl; > cout << " Encrypted 4at: " << get_curr_datetime_str() << endl; > return cipher; > } > catch (CryptoPP::Exception e) { > std::cerr << e.what() << std::endl; > return ""; > } > } > On Friday, May 12, 2023 at 11:17:32 AM UTC-4 Jeffrey Walton wrote: > >> On Fri, May 12, 2023 at 10:48 AM Dwight Kulkarni <dwi...@realtime-7.com> >> wrote: >> > >> > The new library is much faster, but I am still not getting that speed >> in the code. 1 second to encrypt 5 mb versus 3 seconds before. >> > >> > I added the .reserve(...) code also. >> >> Well, you should profile your code to find the bottlenecks. >> >> Jeff >> > -- You received this message because you are subscribed to the Google Groups "Crypto++ Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to cryptopp-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/cryptopp-users/d68e5954-8844-47ae-ab5d-843dd12f8938n%40googlegroups.com.