xref: /freebsd/sys/contrib/libsodium/test/default/core4.c (revision e6bfd18d21b225af6a0ed67ceeaf1293b7b9eba5)
1 
2 #define TEST_NAME "core4"
3 #include "cmptest.h"
4 
5 static unsigned char k[32] = { 1,   2,   3,   4,   5,   6,   7,   8,
6                                9,   10,  11,  12,  13,  14,  15,  16,
7                                201, 202, 203, 204, 205, 206, 207, 208,
8                                209, 210, 211, 212, 213, 214, 215, 216 };
9 
10 static unsigned char in[16] = { 101, 102, 103, 104, 105, 106, 107, 108,
11                                 109, 110, 111, 112, 113, 114, 115, 116 };
12 
13 static unsigned char c[16] = { 101, 120, 112, 97,  110, 100, 32, 51,
14                                50,  45,  98,  121, 116, 101, 32, 107 };
15 
16 static unsigned char out[64];
17 
18 int
19 main(void)
20 {
21     int i;
22 
23     crypto_core_salsa20(out, in, k, c);
24     for (i = 0; i < 64; ++i) {
25         if (i > 0) {
26             printf(",");
27         } else {
28             printf(" ");
29         }
30         printf("%3u", (unsigned int) out[i]);
31         if (i % 8 == 7) {
32             printf("\n");
33         }
34     }
35     return 0;
36 }
37