summaryrefslogtreecommitdiff
path: root/nacl/tests/core1.c
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2013-07-02 09:53:34 -0400
committerirungentoo <irungentoo@gmail.com>2013-07-02 09:53:34 -0400
commite2967396ac73cb7410787886cdaf072a184ffc49 (patch)
tree527a74d25a4a0705fc641994fd35bfab22662034 /nacl/tests/core1.c
parent8928c817df345f29aa0b194743595aa11bd6a8ba (diff)
Added NaCl crypto library.
Diffstat (limited to 'nacl/tests/core1.c')
-rw-r--r--nacl/tests/core1.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/nacl/tests/core1.c b/nacl/tests/core1.c
new file mode 100644
index 00000000..9a8fc51d
--- /dev/null
+++ b/nacl/tests/core1.c
@@ -0,0 +1,30 @@
1#include <stdio.h>
2#include "crypto_core_hsalsa20.h"
3
4unsigned char shared[32] = {
5 0x4a,0x5d,0x9d,0x5b,0xa4,0xce,0x2d,0xe1
6,0x72,0x8e,0x3b,0xf4,0x80,0x35,0x0f,0x25
7,0xe0,0x7e,0x21,0xc9,0x47,0xd1,0x9e,0x33
8,0x76,0xf0,0x9b,0x3c,0x1e,0x16,0x17,0x42
9} ;
10
11unsigned char zero[32] = { 0 };
12
13unsigned char c[16] = {
14 0x65,0x78,0x70,0x61,0x6e,0x64,0x20,0x33
15,0x32,0x2d,0x62,0x79,0x74,0x65,0x20,0x6b
16} ;
17
18unsigned char firstkey[32];
19
20main()
21{
22 int i;
23 crypto_core_hsalsa20(firstkey,zero,shared,c);
24 for (i = 0;i < 32;++i) {
25 if (i > 0) printf(","); else printf(" ");
26 printf("0x%02x",(unsigned int) firstkey[i]);
27 if (i % 8 == 7) printf("\n");
28 }
29 return 0;
30}