I want to encrypt and decrypt strings with RC6 but I don't understand how it works with the Crypto++ library, could you give me a snippet ?
Thanks you !
I want to encrypt and decrypt strings with RC6 but I don't understand how it works with the Crypto++ library, could you give me a snippet ?
Thanks you !
Here's a snippet of code from the Crypto++ website demonstrating how to use the library to encrypt a string using AES (where as jww had pointed out, "RC6 is one of the AES candidates" and the snippet should be usable as a starting point for RC6 as well):
byte key[AES::DEFAULT_KEYLENGTH], iv[AES::BLOCKSIZE];
string plainText;
// ... populate key, iv, plainText here
string cipher;
StringSink* sink = new StringSink(cipher);
Base64Encoder* base64_enc = new Base64Encoder(sink);
CBC_Mode<AES>::Encryption aes(key, sizeof(key), iv);
StreamTransformationFilter* aes_enc = new StreamTransformationFilter(aes, base64_enc);
StringSource source(plainText, true, aes_enc);
I found this information when internet searching for sample code for the Crypto++ library. Admittedly, it wasn't as straight forward for me to find as I had expected.
The Related sidebar on StackOverflow is pointing out other pages that I believe can also help, like the Q & A for Encrypt/Decrypt byte array Crypto++.
Update: An update just showed up today (March 26, 2017) at the RC6 web page at the Crypto++ wiki site. It's got RC6 specific code there now which looks like exactly what you need.