mirror of
https://github.com/monero-project/monero.git
synced 2025-06-19 06:34:11 -04:00
Add a chacha20 variant to go with chacha8
This commit is contained in:
parent
6ca30ae666
commit
1e5491e942
9 changed files with 65 additions and 50 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue