xref: /freebsd/sys/contrib/libsodium/test/default/box_seed.c (revision 0ac341f145426f1f0d00b64d35f19fada2be635c)
1*0ac341f1SConrad Meyer 
2*0ac341f1SConrad Meyer #define TEST_NAME "box_seed"
3*0ac341f1SConrad Meyer #include "cmptest.h"
4*0ac341f1SConrad Meyer 
5*0ac341f1SConrad Meyer static unsigned char seed[32] = { 0x77, 0x07, 0x6d, 0x0a, 0x73, 0x18, 0xa5,
6*0ac341f1SConrad Meyer                                   0x7d, 0x3c, 0x16, 0xc1, 0x72, 0x51, 0xb2,
7*0ac341f1SConrad Meyer                                   0x66, 0x45, 0xdf, 0x4c, 0x2f, 0x87, 0xeb,
8*0ac341f1SConrad Meyer                                   0xc0, 0x99, 0x2a, 0xb1, 0x77, 0xfb, 0xa5,
9*0ac341f1SConrad Meyer                                   0x1d, 0xb9, 0x2c, 0x2a };
10*0ac341f1SConrad Meyer 
11*0ac341f1SConrad Meyer int
12*0ac341f1SConrad Meyer main(void)
13*0ac341f1SConrad Meyer {
14*0ac341f1SConrad Meyer     int           i;
15*0ac341f1SConrad Meyer     unsigned char sk[32];
16*0ac341f1SConrad Meyer     unsigned char pk[32];
17*0ac341f1SConrad Meyer 
18*0ac341f1SConrad Meyer     crypto_box_seed_keypair(pk, sk, seed);
19*0ac341f1SConrad Meyer     for (i = 0; i < 32; ++i) {
20*0ac341f1SConrad Meyer         printf(",0x%02x", (unsigned int) pk[i]);
21*0ac341f1SConrad Meyer         if (i % 8 == 7)
22*0ac341f1SConrad Meyer             printf("\n");
23*0ac341f1SConrad Meyer     }
24*0ac341f1SConrad Meyer     for (i = 0; i < 32; ++i) {
25*0ac341f1SConrad Meyer         printf(",0x%02x", (unsigned int) sk[i]);
26*0ac341f1SConrad Meyer         if (i % 8 == 7)
27*0ac341f1SConrad Meyer             printf("\n");
28*0ac341f1SConrad Meyer     }
29*0ac341f1SConrad Meyer     return 0;
30*0ac341f1SConrad Meyer }
31