Add encode feature
This is not an issue, it is only a proposal: would be nice if you add an encoding feature ?
I have tested your code, and on this step:
plusaes::encrypt_cbc((unsigned char*)raw_data.data(), raw_data.size(), &key[0], key.size(), &iv, &encrypted[0], encrypted.size(), true);
// fb 7b ae 95 d5 0f c5 6f 43 7d 14 6b 6a 29 15 70
std::cout << encrypted.data() << std::endl;
And here is the listing of the outome:
√{«ò╒☼┼oC}¶kj)§p²²²²
It would be nice if you add an encoding option for this encrypted string, in order to have intelligibile chars instead of these weird chars ?
for (const auto& entry : encrypted) { std::stringstream hex; uint32_t to_hex = entry; hex << std::hex << to_hex; std::cout << hex.str() << " "; } std::cout << std::endl;
I think that it is not a feature of the encryption (plusaes) library. It is a feature of binary handling.
For example, we can use std::string as input data or output buffer (The example code in the README is it).
My image.
SmartBytes buf(data_size);
plusaes::decrypt_cbc(
encrypted, encrypted_size, key, key_size, iv,
buf.data(), buf.size(), // Pass as output buffer
&padded_size);
buf.to_string(kEncodingUtf8);
buf.to_base64()
No reply, out of scope