Hi Everyone,

I created a 5 MB message and encrypted it. The message takes 3 seconds to 
encrypt. I needed something around 200 ms, even if the encryption is weaker.

My code is below, should I be setting any flags when compiling the library 
to make it fast ?  

 Got message str at: 05/11/2023 20:21:31.346
 in encrypt aes 
 Encrypted at: 05/11/2023 20:21:33.027

message_bytes = encrypt_aes(message_bytes, key, iv);
cout << " Encrypted at: " << get_curr_datetime_str() << endl;


std::string encrypt_aes(std::string message, SecByteBlock key, SecByteBlock 
iv) {
try {
cout <<" in encrypt aes " <<endl;
AlgorithmParameters params = MakeParameters(Name::FeedbackSize(), 1
/*8-bits*/)
(Name::IV(), ConstByteArrayParameter(iv));
CFB_Mode<AES>::Encryption e;
std::string cipher;
e.SetKey(key, key.size(), params);
StringSource ss(message, true, new StreamTransformationFilter(e, new 
StringSink(cipher)));
cout << " returning cipher " << endl;
return cipher;
}
catch (CryptoPP::Exception e) {
std::cerr << e.what() << std::endl;
return "";
}
}

-- 
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/b3e4b9f7-be5f-4c11-9f27-810696f8d6cfn%40googlegroups.com.

Reply via email to