mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
AEAD/Chacha20/Poly1305 encrypt multiple buffers
This commit is contained in:
parent
0c9ebc36d4
commit
e68f1dbc99
5 changed files with 130 additions and 69 deletions
|
@ -51,4 +51,10 @@ int main ()
|
|||
uint8_t buf1[114];
|
||||
assert (i2p::crypto::AEADChaCha20Poly1305 (buf, 114, ad, 12, key, nonce, buf1, 114, false));
|
||||
assert (memcmp (buf1, text, 114) == 0);
|
||||
// test encryption of multiple buffers
|
||||
memcpy (buf, text, 114);
|
||||
std::vector<std::pair<void*, std::size_t> > bufs{ std::make_pair (buf, 114) };
|
||||
i2p::crypto::AEADChaCha20Poly1305Encrypt (bufs, key, nonce, buf + 114);
|
||||
i2p::crypto::AEADChaCha20Poly1305 (buf, 114, nullptr, 0, key, nonce, buf1, 114, false);
|
||||
assert (memcmp (buf1, text, 114) == 0);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue