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