mirror of
https://github.com/monero-project/monero.git
synced 2025-12-22 07:10:46 -08:00
Add a chacha20 variant to go with chacha8
This commit is contained in:
@@ -802,12 +802,12 @@ TEST(Serialization, portability_outputs)
|
||||
// decrypt (copied from wallet2::decrypt)
|
||||
auto decrypt = [] (const std::string &ciphertext, const crypto::secret_key &skey, bool authenticated) -> string
|
||||
{
|
||||
const size_t prefix_size = sizeof(chacha8_iv) + (authenticated ? sizeof(crypto::signature) : 0);
|
||||
const size_t prefix_size = sizeof(chacha_iv) + (authenticated ? sizeof(crypto::signature) : 0);
|
||||
if(ciphertext.size() < prefix_size)
|
||||
return {};
|
||||
crypto::chacha8_key key;
|
||||
crypto::generate_chacha8_key(&skey, sizeof(skey), key);
|
||||
const crypto::chacha8_iv &iv = *(const crypto::chacha8_iv*)&ciphertext[0];
|
||||
crypto::chacha_key key;
|
||||
crypto::generate_chacha_key(&skey, sizeof(skey), key);
|
||||
const crypto::chacha_iv &iv = *(const crypto::chacha_iv*)&ciphertext[0];
|
||||
std::string plaintext;
|
||||
plaintext.resize(ciphertext.size() - prefix_size);
|
||||
if (authenticated)
|
||||
|
||||
Reference in New Issue
Block a user