mirror of
https://github.com/jedisct1/libsodium.git
synced 2024-12-23 12:05:11 -07:00
Add a test for crypto_stream_salsa20_xor_ic()
This commit is contained in:
parent
cdf863c731
commit
666fd4323b
@ -17,7 +17,19 @@ unsigned char h[32];
|
||||
int main(void)
|
||||
{
|
||||
int i;
|
||||
crypto_stream_salsa20(output, 4194304, noncesuffix, secondkey);
|
||||
crypto_stream_salsa20(output, sizeof output, noncesuffix, secondkey);
|
||||
crypto_hash_sha256(h, output, sizeof output);
|
||||
for (i = 0; i < 32; ++i)
|
||||
printf("%02x", h[i]);
|
||||
printf("\n");
|
||||
|
||||
assert(sizeof output > 4000);
|
||||
|
||||
crypto_stream_salsa20_xor_ic(output, output, 4000, noncesuffix, 0U, secondkey);
|
||||
for (i = 0; i < 4000; ++i)
|
||||
assert(output[i] == 0);
|
||||
|
||||
crypto_stream_salsa20_xor_ic(output, output, 4000, noncesuffix, 1U, secondkey);
|
||||
crypto_hash_sha256(h, output, sizeof output);
|
||||
for (i = 0; i < 32; ++i)
|
||||
printf("%02x", h[i]);
|
||||
|
@ -1 +1,2 @@
|
||||
662b9d0e3463029156069b12f918691a98f7dfb2ca0393c96bbfc6b1fbd630a2
|
||||
0cc9ffaf60a99d221b548e9762385a231121ab226d1c610d2661ced26b6ad5ee
|
||||
|
Loading…
Reference in New Issue
Block a user