xref: /freebsd/sys/contrib/libsodium/test/default/stream3.c (revision 3611ec604864a7d4dcc9a3ea898c80eb35eef8a0)
1*0ac341f1SConrad Meyer 
2*0ac341f1SConrad Meyer #define TEST_NAME "stream3"
3*0ac341f1SConrad Meyer #include "cmptest.h"
4*0ac341f1SConrad Meyer 
5*0ac341f1SConrad Meyer static unsigned char firstkey[32] = { 0x1b, 0x27, 0x55, 0x64, 0x73, 0xe9, 0x85,
6*0ac341f1SConrad Meyer                                       0xd4, 0x62, 0xcd, 0x51, 0x19, 0x7a, 0x9a,
7*0ac341f1SConrad Meyer                                       0x46, 0xc7, 0x60, 0x09, 0x54, 0x9e, 0xac,
8*0ac341f1SConrad Meyer                                       0x64, 0x74, 0xf2, 0x06, 0xc4, 0xee, 0x08,
9*0ac341f1SConrad Meyer                                       0x44, 0xf6, 0x83, 0x89 };
10*0ac341f1SConrad Meyer 
11*0ac341f1SConrad Meyer static unsigned char nonce[24] = { 0x69, 0x69, 0x6e, 0xe9, 0x55, 0xb6,
12*0ac341f1SConrad Meyer                                    0x2b, 0x73, 0xcd, 0x62, 0xbd, 0xa8,
13*0ac341f1SConrad Meyer                                    0x75, 0xfc, 0x73, 0xd6, 0x82, 0x19,
14*0ac341f1SConrad Meyer                                    0xe0, 0x03, 0x6b, 0x7a, 0x0b, 0x37 };
15*0ac341f1SConrad Meyer 
16*0ac341f1SConrad Meyer static unsigned char rs[32];
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_stream(rs, 32, nonce, firstkey);
24*0ac341f1SConrad Meyer 
25*0ac341f1SConrad Meyer     for (i = 0; i < 32; ++i) {
26*0ac341f1SConrad Meyer         printf(",0x%02x", (unsigned int) rs[i]);
27*0ac341f1SConrad Meyer         if (i % 8 == 7)
28*0ac341f1SConrad Meyer             printf("\n");
29*0ac341f1SConrad Meyer     }
30*0ac341f1SConrad Meyer     return 0;
31*0ac341f1SConrad Meyer }
32