diff options
Diffstat (limited to 'nacl/tests')
106 files changed, 0 insertions, 2257 deletions
diff --git a/nacl/tests/auth.c b/nacl/tests/auth.c deleted file mode 100644 index 5086624e..00000000 --- a/nacl/tests/auth.c +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | #include "crypto_auth_hmacsha512256.h" | ||
3 | |||
4 | /* "Test Case 2" from RFC 4231 */ | ||
5 | unsigned char key[32] = "Jefe"; | ||
6 | unsigned char c[28] = "what do ya want for nothing?"; | ||
7 | |||
8 | unsigned char a[32]; | ||
9 | |||
10 | main() | ||
11 | { | ||
12 | int i; | ||
13 | crypto_auth_hmacsha512256(a,c,sizeof c,key); | ||
14 | for (i = 0;i < 32;++i) { | ||
15 | printf(",0x%02x",(unsigned int) a[i]); | ||
16 | if (i % 8 == 7) printf("\n"); | ||
17 | } | ||
18 | return 0; | ||
19 | } | ||
diff --git a/nacl/tests/auth.out b/nacl/tests/auth.out deleted file mode 100644 index 35e5909d..00000000 --- a/nacl/tests/auth.out +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | ,0x16,0x4b,0x7a,0x7b,0xfc,0xf8,0x19,0xe2 | ||
2 | ,0xe3,0x95,0xfb,0xe7,0x3b,0x56,0xe0,0xa3 | ||
3 | ,0x87,0xbd,0x64,0x22,0x2e,0x83,0x1f,0xd6 | ||
4 | ,0x10,0x27,0x0c,0xd7,0xea,0x25,0x05,0x54 | ||
diff --git a/nacl/tests/auth2.c b/nacl/tests/auth2.c deleted file mode 100644 index ba191de4..00000000 --- a/nacl/tests/auth2.c +++ /dev/null | |||
@@ -1,34 +0,0 @@ | |||
1 | /* "Test Case AUTH256-4" from RFC 4868 */ | ||
2 | |||
3 | #include <stdio.h> | ||
4 | #include "crypto_auth_hmacsha256.h" | ||
5 | |||
6 | unsigned char key[32] = { | ||
7 | 0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08 | ||
8 | ,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10 | ||
9 | ,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18 | ||
10 | ,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,0x20 | ||
11 | } ; | ||
12 | |||
13 | unsigned char c[50] = { | ||
14 | 0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd | ||
15 | ,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd | ||
16 | ,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd | ||
17 | ,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd | ||
18 | ,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd | ||
19 | ,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd | ||
20 | ,0xcd,0xcd | ||
21 | } ; | ||
22 | |||
23 | unsigned char a[32]; | ||
24 | |||
25 | main() | ||
26 | { | ||
27 | int i; | ||
28 | crypto_auth_hmacsha256(a,c,sizeof c,key); | ||
29 | for (i = 0;i < 32;++i) { | ||
30 | printf(",0x%02x",(unsigned int) a[i]); | ||
31 | if (i % 8 == 7) printf("\n"); | ||
32 | } | ||
33 | return 0; | ||
34 | } | ||
diff --git a/nacl/tests/auth2.out b/nacl/tests/auth2.out deleted file mode 100644 index 955951a2..00000000 --- a/nacl/tests/auth2.out +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | ,0x37,0x2e,0xfc,0xf9,0xb4,0x0b,0x35,0xc2 | ||
2 | ,0x11,0x5b,0x13,0x46,0x90,0x3d,0x2e,0xf4 | ||
3 | ,0x2f,0xce,0xd4,0x6f,0x08,0x46,0xe7,0x25 | ||
4 | ,0x7b,0xb1,0x56,0xd3,0xd7,0xb3,0x0d,0x3f | ||
diff --git a/nacl/tests/auth3.c b/nacl/tests/auth3.c deleted file mode 100644 index b713b388..00000000 --- a/nacl/tests/auth3.c +++ /dev/null | |||
@@ -1,34 +0,0 @@ | |||
1 | /* "Test Case AUTH256-4" from RFC 4868 */ | ||
2 | |||
3 | #include <stdio.h> | ||
4 | #include "crypto_auth_hmacsha256.h" | ||
5 | |||
6 | unsigned char key[32] = { | ||
7 | 0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08 | ||
8 | ,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10 | ||
9 | ,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18 | ||
10 | ,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,0x20 | ||
11 | } ; | ||
12 | |||
13 | unsigned char c[50] = { | ||
14 | 0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd | ||
15 | ,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd | ||
16 | ,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd | ||
17 | ,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd | ||
18 | ,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd | ||
19 | ,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd | ||
20 | ,0xcd,0xcd | ||
21 | } ; | ||
22 | |||
23 | unsigned char a[32] = { | ||
24 | 0x37,0x2e,0xfc,0xf9,0xb4,0x0b,0x35,0xc2 | ||
25 | ,0x11,0x5b,0x13,0x46,0x90,0x3d,0x2e,0xf4 | ||
26 | ,0x2f,0xce,0xd4,0x6f,0x08,0x46,0xe7,0x25 | ||
27 | ,0x7b,0xb1,0x56,0xd3,0xd7,0xb3,0x0d,0x3f | ||
28 | } ; | ||
29 | |||
30 | main() | ||
31 | { | ||
32 | printf("%d\n",crypto_auth_hmacsha256_verify(a,c,sizeof c,key)); | ||
33 | return 0; | ||
34 | } | ||
diff --git a/nacl/tests/auth3.out b/nacl/tests/auth3.out deleted file mode 100644 index 573541ac..00000000 --- a/nacl/tests/auth3.out +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | 0 | ||
diff --git a/nacl/tests/auth4.cpp b/nacl/tests/auth4.cpp deleted file mode 100644 index a94837d2..00000000 --- a/nacl/tests/auth4.cpp +++ /dev/null | |||
@@ -1,44 +0,0 @@ | |||
1 | /* "Test Case AUTH256-4" from RFC 4868 */ | ||
2 | |||
3 | #include <string> | ||
4 | using std::string; | ||
5 | #include <stdio.h> | ||
6 | #include "crypto_auth_hmacsha256.h" | ||
7 | |||
8 | char key_bytes[32] = { | ||
9 | 0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08 | ||
10 | ,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10 | ||
11 | ,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18 | ||
12 | ,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,0x20 | ||
13 | } ; | ||
14 | |||
15 | char c_bytes[50] = { | ||
16 | 0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd | ||
17 | ,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd | ||
18 | ,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd | ||
19 | ,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd | ||
20 | ,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd | ||
21 | ,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd | ||
22 | ,0xcd,0xcd | ||
23 | } ; | ||
24 | |||
25 | char a_bytes[32] = { | ||
26 | 0x37,0x2e,0xfc,0xf9,0xb4,0x0b,0x35,0xc2 | ||
27 | ,0x11,0x5b,0x13,0x46,0x90,0x3d,0x2e,0xf4 | ||
28 | ,0x2f,0xce,0xd4,0x6f,0x08,0x46,0xe7,0x25 | ||
29 | ,0x7b,0xb1,0x56,0xd3,0xd7,0xb3,0x0d,0x3f | ||
30 | } ; | ||
31 | |||
32 | main() | ||
33 | { | ||
34 | string key(key_bytes,sizeof key_bytes); | ||
35 | string c(c_bytes,sizeof c_bytes); | ||
36 | string a(a_bytes,sizeof a_bytes); | ||
37 | try { | ||
38 | crypto_auth_hmacsha256_verify(a,c,key); | ||
39 | printf("0\n"); | ||
40 | } catch(const char *s) { | ||
41 | printf("%s\n",s); | ||
42 | } | ||
43 | return 0; | ||
44 | } | ||
diff --git a/nacl/tests/auth4.out b/nacl/tests/auth4.out deleted file mode 100644 index 573541ac..00000000 --- a/nacl/tests/auth4.out +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | 0 | ||
diff --git a/nacl/tests/auth5.c b/nacl/tests/auth5.c deleted file mode 100644 index d304a073..00000000 --- a/nacl/tests/auth5.c +++ /dev/null | |||
@@ -1,36 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | #include <stdlib.h> | ||
3 | #include "crypto_auth_hmacsha512256.h" | ||
4 | #include "randombytes.h" | ||
5 | |||
6 | unsigned char key[32]; | ||
7 | unsigned char c[10000]; | ||
8 | unsigned char a[32]; | ||
9 | |||
10 | main() | ||
11 | { | ||
12 | int clen; | ||
13 | int i; | ||
14 | for (clen = 0;clen < 10000;++clen) { | ||
15 | randombytes(key,sizeof key); | ||
16 | randombytes(c,clen); | ||
17 | crypto_auth_hmacsha512256(a,c,clen,key); | ||
18 | if (crypto_auth_hmacsha512256_verify(a,c,clen,key) != 0) { | ||
19 | printf("fail %d\n",clen); | ||
20 | return 100; | ||
21 | } | ||
22 | if (clen > 0) { | ||
23 | c[random() % clen] += 1 + (random() % 255); | ||
24 | if (crypto_auth_hmacsha512256_verify(a,c,clen,key) == 0) { | ||
25 | printf("forgery %d\n",clen); | ||
26 | return 100; | ||
27 | } | ||
28 | a[random() % sizeof a] += 1 + (random() % 255); | ||
29 | if (crypto_auth_hmacsha512256_verify(a,c,clen,key) == 0) { | ||
30 | printf("forgery %d\n",clen); | ||
31 | return 100; | ||
32 | } | ||
33 | } | ||
34 | } | ||
35 | return 0; | ||
36 | } | ||
diff --git a/nacl/tests/auth5.out b/nacl/tests/auth5.out deleted file mode 100644 index e69de29b..00000000 --- a/nacl/tests/auth5.out +++ /dev/null | |||
diff --git a/nacl/tests/auth6.cpp b/nacl/tests/auth6.cpp deleted file mode 100644 index dffb6388..00000000 --- a/nacl/tests/auth6.cpp +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | #include <string> | ||
2 | using std::string; | ||
3 | #include <stdio.h> | ||
4 | #include <stdlib.h> | ||
5 | #include "crypto_auth_hmacsha512256.h" | ||
6 | #include "randombytes.h" | ||
7 | |||
8 | main() | ||
9 | { | ||
10 | int clen; | ||
11 | int i; | ||
12 | for (clen = 0;clen < 10000;++clen) { | ||
13 | unsigned char key_bytes[32]; | ||
14 | randombytes(key_bytes,sizeof key_bytes); | ||
15 | string key((char *) key_bytes,sizeof key_bytes); | ||
16 | unsigned char c_bytes[clen]; | ||
17 | randombytes(c_bytes,sizeof c_bytes); | ||
18 | string c((char *) c_bytes,sizeof c_bytes); | ||
19 | string a = crypto_auth_hmacsha512256(c,key); | ||
20 | try { | ||
21 | crypto_auth_hmacsha512256_verify(a,c,key); | ||
22 | } catch(const char *s) { | ||
23 | printf("fail %d %s\n",clen,s); | ||
24 | return 100; | ||
25 | } | ||
26 | if (clen > 0) { | ||
27 | size_t pos = random() % clen; | ||
28 | c.replace(pos,1,1,c[pos] + 1 + (random() % 255)); | ||
29 | try { | ||
30 | crypto_auth_hmacsha512256_verify(a,c,key); | ||
31 | printf("forgery %d\n",clen); | ||
32 | } catch(const char *s) { | ||
33 | ; | ||
34 | } | ||
35 | pos = random() % a.size(); | ||
36 | a.replace(pos,1,1,a[pos] + 1 + (random() % 255)); | ||
37 | try { | ||
38 | crypto_auth_hmacsha512256_verify(a,c,key); | ||
39 | printf("forgery %d\n",clen); | ||
40 | } catch(const char *s) { | ||
41 | ; | ||
42 | } | ||
43 | } | ||
44 | } | ||
45 | return 0; | ||
46 | } | ||
diff --git a/nacl/tests/auth6.out b/nacl/tests/auth6.out deleted file mode 100644 index e69de29b..00000000 --- a/nacl/tests/auth6.out +++ /dev/null | |||
diff --git a/nacl/tests/box.c b/nacl/tests/box.c deleted file mode 100644 index b57a9883..00000000 --- a/nacl/tests/box.c +++ /dev/null | |||
@@ -1,63 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | #include "crypto_box_curve25519xsalsa20poly1305.h" | ||
3 | |||
4 | unsigned char alicesk[32] = { | ||
5 | 0x77,0x07,0x6d,0x0a,0x73,0x18,0xa5,0x7d | ||
6 | ,0x3c,0x16,0xc1,0x72,0x51,0xb2,0x66,0x45 | ||
7 | ,0xdf,0x4c,0x2f,0x87,0xeb,0xc0,0x99,0x2a | ||
8 | ,0xb1,0x77,0xfb,0xa5,0x1d,0xb9,0x2c,0x2a | ||
9 | } ; | ||
10 | |||
11 | unsigned char bobpk[32] = { | ||
12 | 0xde,0x9e,0xdb,0x7d,0x7b,0x7d,0xc1,0xb4 | ||
13 | ,0xd3,0x5b,0x61,0xc2,0xec,0xe4,0x35,0x37 | ||
14 | ,0x3f,0x83,0x43,0xc8,0x5b,0x78,0x67,0x4d | ||
15 | ,0xad,0xfc,0x7e,0x14,0x6f,0x88,0x2b,0x4f | ||
16 | } ; | ||
17 | |||
18 | unsigned char nonce[24] = { | ||
19 | 0x69,0x69,0x6e,0xe9,0x55,0xb6,0x2b,0x73 | ||
20 | ,0xcd,0x62,0xbd,0xa8,0x75,0xfc,0x73,0xd6 | ||
21 | ,0x82,0x19,0xe0,0x03,0x6b,0x7a,0x0b,0x37 | ||
22 | } ; | ||
23 | |||
24 | // API requires first 32 bytes to be 0 | ||
25 | unsigned char m[163] = { | ||
26 | 0, 0, 0, 0, 0, 0, 0, 0 | ||
27 | , 0, 0, 0, 0, 0, 0, 0, 0 | ||
28 | , 0, 0, 0, 0, 0, 0, 0, 0 | ||
29 | , 0, 0, 0, 0, 0, 0, 0, 0 | ||
30 | ,0xbe,0x07,0x5f,0xc5,0x3c,0x81,0xf2,0xd5 | ||
31 | ,0xcf,0x14,0x13,0x16,0xeb,0xeb,0x0c,0x7b | ||
32 | ,0x52,0x28,0xc5,0x2a,0x4c,0x62,0xcb,0xd4 | ||
33 | ,0x4b,0x66,0x84,0x9b,0x64,0x24,0x4f,0xfc | ||
34 | ,0xe5,0xec,0xba,0xaf,0x33,0xbd,0x75,0x1a | ||
35 | ,0x1a,0xc7,0x28,0xd4,0x5e,0x6c,0x61,0x29 | ||
36 | ,0x6c,0xdc,0x3c,0x01,0x23,0x35,0x61,0xf4 | ||
37 | ,0x1d,0xb6,0x6c,0xce,0x31,0x4a,0xdb,0x31 | ||
38 | ,0x0e,0x3b,0xe8,0x25,0x0c,0x46,0xf0,0x6d | ||
39 | ,0xce,0xea,0x3a,0x7f,0xa1,0x34,0x80,0x57 | ||
40 | ,0xe2,0xf6,0x55,0x6a,0xd6,0xb1,0x31,0x8a | ||
41 | ,0x02,0x4a,0x83,0x8f,0x21,0xaf,0x1f,0xde | ||
42 | ,0x04,0x89,0x77,0xeb,0x48,0xf5,0x9f,0xfd | ||
43 | ,0x49,0x24,0xca,0x1c,0x60,0x90,0x2e,0x52 | ||
44 | ,0xf0,0xa0,0x89,0xbc,0x76,0x89,0x70,0x40 | ||
45 | ,0xe0,0x82,0xf9,0x37,0x76,0x38,0x48,0x64 | ||
46 | ,0x5e,0x07,0x05 | ||
47 | } ; | ||
48 | |||
49 | unsigned char c[163]; | ||
50 | |||
51 | main() | ||
52 | { | ||
53 | int i; | ||
54 | crypto_box_curve25519xsalsa20poly1305( | ||
55 | c,m,163,nonce,bobpk,alicesk | ||
56 | ); | ||
57 | for (i = 16;i < 163;++i) { | ||
58 | printf(",0x%02x",(unsigned int) c[i]); | ||
59 | if (i % 8 == 7) printf("\n"); | ||
60 | } | ||
61 | printf("\n"); | ||
62 | return 0; | ||
63 | } | ||
diff --git a/nacl/tests/box.out b/nacl/tests/box.out deleted file mode 100644 index 2b6c51ea..00000000 --- a/nacl/tests/box.out +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | ,0xf3,0xff,0xc7,0x70,0x3f,0x94,0x00,0xe5 | ||
2 | ,0x2a,0x7d,0xfb,0x4b,0x3d,0x33,0x05,0xd9 | ||
3 | ,0x8e,0x99,0x3b,0x9f,0x48,0x68,0x12,0x73 | ||
4 | ,0xc2,0x96,0x50,0xba,0x32,0xfc,0x76,0xce | ||
5 | ,0x48,0x33,0x2e,0xa7,0x16,0x4d,0x96,0xa4 | ||
6 | ,0x47,0x6f,0xb8,0xc5,0x31,0xa1,0x18,0x6a | ||
7 | ,0xc0,0xdf,0xc1,0x7c,0x98,0xdc,0xe8,0x7b | ||
8 | ,0x4d,0xa7,0xf0,0x11,0xec,0x48,0xc9,0x72 | ||
9 | ,0x71,0xd2,0xc2,0x0f,0x9b,0x92,0x8f,0xe2 | ||
10 | ,0x27,0x0d,0x6f,0xb8,0x63,0xd5,0x17,0x38 | ||
11 | ,0xb4,0x8e,0xee,0xe3,0x14,0xa7,0xcc,0x8a | ||
12 | ,0xb9,0x32,0x16,0x45,0x48,0xe5,0x26,0xae | ||
13 | ,0x90,0x22,0x43,0x68,0x51,0x7a,0xcf,0xea | ||
14 | ,0xbd,0x6b,0xb3,0x73,0x2b,0xc0,0xe9,0xda | ||
15 | ,0x99,0x83,0x2b,0x61,0xca,0x01,0xb6,0xde | ||
16 | ,0x56,0x24,0x4a,0x9e,0x88,0xd5,0xf9,0xb3 | ||
17 | ,0x79,0x73,0xf6,0x22,0xa4,0x3d,0x14,0xa6 | ||
18 | ,0x59,0x9b,0x1f,0x65,0x4c,0xb4,0x5a,0x74 | ||
19 | ,0xe3,0x55,0xa5 | ||
diff --git a/nacl/tests/box2.c b/nacl/tests/box2.c deleted file mode 100644 index 0a531142..00000000 --- a/nacl/tests/box2.c +++ /dev/null | |||
@@ -1,64 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | #include "crypto_box_curve25519xsalsa20poly1305.h" | ||
3 | |||
4 | unsigned char bobsk[32] = { | ||
5 | 0x5d,0xab,0x08,0x7e,0x62,0x4a,0x8a,0x4b | ||
6 | ,0x79,0xe1,0x7f,0x8b,0x83,0x80,0x0e,0xe6 | ||
7 | ,0x6f,0x3b,0xb1,0x29,0x26,0x18,0xb6,0xfd | ||
8 | ,0x1c,0x2f,0x8b,0x27,0xff,0x88,0xe0,0xeb | ||
9 | } ; | ||
10 | |||
11 | unsigned char alicepk[32] = { | ||
12 | 0x85,0x20,0xf0,0x09,0x89,0x30,0xa7,0x54 | ||
13 | ,0x74,0x8b,0x7d,0xdc,0xb4,0x3e,0xf7,0x5a | ||
14 | ,0x0d,0xbf,0x3a,0x0d,0x26,0x38,0x1a,0xf4 | ||
15 | ,0xeb,0xa4,0xa9,0x8e,0xaa,0x9b,0x4e,0x6a | ||
16 | } ; | ||
17 | |||
18 | unsigned char nonce[24] = { | ||
19 | 0x69,0x69,0x6e,0xe9,0x55,0xb6,0x2b,0x73 | ||
20 | ,0xcd,0x62,0xbd,0xa8,0x75,0xfc,0x73,0xd6 | ||
21 | ,0x82,0x19,0xe0,0x03,0x6b,0x7a,0x0b,0x37 | ||
22 | } ; | ||
23 | |||
24 | // API requires first 16 bytes to be 0 | ||
25 | unsigned char c[163] = { | ||
26 | 0, 0, 0, 0, 0, 0, 0, 0 | ||
27 | , 0, 0, 0, 0, 0, 0, 0, 0 | ||
28 | ,0xf3,0xff,0xc7,0x70,0x3f,0x94,0x00,0xe5 | ||
29 | ,0x2a,0x7d,0xfb,0x4b,0x3d,0x33,0x05,0xd9 | ||
30 | ,0x8e,0x99,0x3b,0x9f,0x48,0x68,0x12,0x73 | ||
31 | ,0xc2,0x96,0x50,0xba,0x32,0xfc,0x76,0xce | ||
32 | ,0x48,0x33,0x2e,0xa7,0x16,0x4d,0x96,0xa4 | ||
33 | ,0x47,0x6f,0xb8,0xc5,0x31,0xa1,0x18,0x6a | ||
34 | ,0xc0,0xdf,0xc1,0x7c,0x98,0xdc,0xe8,0x7b | ||
35 | ,0x4d,0xa7,0xf0,0x11,0xec,0x48,0xc9,0x72 | ||
36 | ,0x71,0xd2,0xc2,0x0f,0x9b,0x92,0x8f,0xe2 | ||
37 | ,0x27,0x0d,0x6f,0xb8,0x63,0xd5,0x17,0x38 | ||
38 | ,0xb4,0x8e,0xee,0xe3,0x14,0xa7,0xcc,0x8a | ||
39 | ,0xb9,0x32,0x16,0x45,0x48,0xe5,0x26,0xae | ||
40 | ,0x90,0x22,0x43,0x68,0x51,0x7a,0xcf,0xea | ||
41 | ,0xbd,0x6b,0xb3,0x73,0x2b,0xc0,0xe9,0xda | ||
42 | ,0x99,0x83,0x2b,0x61,0xca,0x01,0xb6,0xde | ||
43 | ,0x56,0x24,0x4a,0x9e,0x88,0xd5,0xf9,0xb3 | ||
44 | ,0x79,0x73,0xf6,0x22,0xa4,0x3d,0x14,0xa6 | ||
45 | ,0x59,0x9b,0x1f,0x65,0x4c,0xb4,0x5a,0x74 | ||
46 | ,0xe3,0x55,0xa5 | ||
47 | } ; | ||
48 | |||
49 | unsigned char m[163]; | ||
50 | |||
51 | main() | ||
52 | { | ||
53 | int i; | ||
54 | if (crypto_box_curve25519xsalsa20poly1305_open( | ||
55 | m,c,163,nonce,alicepk,bobsk | ||
56 | ) == 0) { | ||
57 | for (i = 32;i < 163;++i) { | ||
58 | printf(",0x%02x",(unsigned int) m[i]); | ||
59 | if (i % 8 == 7) printf("\n"); | ||
60 | } | ||
61 | printf("\n"); | ||
62 | } | ||
63 | return 0; | ||
64 | } | ||
diff --git a/nacl/tests/box2.out b/nacl/tests/box2.out deleted file mode 100644 index c61d4557..00000000 --- a/nacl/tests/box2.out +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | ,0xbe,0x07,0x5f,0xc5,0x3c,0x81,0xf2,0xd5 | ||
2 | ,0xcf,0x14,0x13,0x16,0xeb,0xeb,0x0c,0x7b | ||
3 | ,0x52,0x28,0xc5,0x2a,0x4c,0x62,0xcb,0xd4 | ||
4 | ,0x4b,0x66,0x84,0x9b,0x64,0x24,0x4f,0xfc | ||
5 | ,0xe5,0xec,0xba,0xaf,0x33,0xbd,0x75,0x1a | ||
6 | ,0x1a,0xc7,0x28,0xd4,0x5e,0x6c,0x61,0x29 | ||
7 | ,0x6c,0xdc,0x3c,0x01,0x23,0x35,0x61,0xf4 | ||
8 | ,0x1d,0xb6,0x6c,0xce,0x31,0x4a,0xdb,0x31 | ||
9 | ,0x0e,0x3b,0xe8,0x25,0x0c,0x46,0xf0,0x6d | ||
10 | ,0xce,0xea,0x3a,0x7f,0xa1,0x34,0x80,0x57 | ||
11 | ,0xe2,0xf6,0x55,0x6a,0xd6,0xb1,0x31,0x8a | ||
12 | ,0x02,0x4a,0x83,0x8f,0x21,0xaf,0x1f,0xde | ||
13 | ,0x04,0x89,0x77,0xeb,0x48,0xf5,0x9f,0xfd | ||
14 | ,0x49,0x24,0xca,0x1c,0x60,0x90,0x2e,0x52 | ||
15 | ,0xf0,0xa0,0x89,0xbc,0x76,0x89,0x70,0x40 | ||
16 | ,0xe0,0x82,0xf9,0x37,0x76,0x38,0x48,0x64 | ||
17 | ,0x5e,0x07,0x05 | ||
diff --git a/nacl/tests/box3.cpp b/nacl/tests/box3.cpp deleted file mode 100644 index db89dd03..00000000 --- a/nacl/tests/box3.cpp +++ /dev/null | |||
@@ -1,60 +0,0 @@ | |||
1 | #include <string> | ||
2 | using std::string; | ||
3 | #include <stdio.h> | ||
4 | #include "crypto_box_curve25519xsalsa20poly1305.h" | ||
5 | |||
6 | char alicesk_bytes[32] = { | ||
7 | 0x77,0x07,0x6d,0x0a,0x73,0x18,0xa5,0x7d | ||
8 | ,0x3c,0x16,0xc1,0x72,0x51,0xb2,0x66,0x45 | ||
9 | ,0xdf,0x4c,0x2f,0x87,0xeb,0xc0,0x99,0x2a | ||
10 | ,0xb1,0x77,0xfb,0xa5,0x1d,0xb9,0x2c,0x2a | ||
11 | } ; | ||
12 | |||
13 | char bobpk_bytes[32] = { | ||
14 | 0xde,0x9e,0xdb,0x7d,0x7b,0x7d,0xc1,0xb4 | ||
15 | ,0xd3,0x5b,0x61,0xc2,0xec,0xe4,0x35,0x37 | ||
16 | ,0x3f,0x83,0x43,0xc8,0x5b,0x78,0x67,0x4d | ||
17 | ,0xad,0xfc,0x7e,0x14,0x6f,0x88,0x2b,0x4f | ||
18 | } ; | ||
19 | |||
20 | char nonce_bytes[24] = { | ||
21 | 0x69,0x69,0x6e,0xe9,0x55,0xb6,0x2b,0x73 | ||
22 | ,0xcd,0x62,0xbd,0xa8,0x75,0xfc,0x73,0xd6 | ||
23 | ,0x82,0x19,0xe0,0x03,0x6b,0x7a,0x0b,0x37 | ||
24 | } ; | ||
25 | |||
26 | char m_bytes[131] = { | ||
27 | 0xbe,0x07,0x5f,0xc5,0x3c,0x81,0xf2,0xd5 | ||
28 | ,0xcf,0x14,0x13,0x16,0xeb,0xeb,0x0c,0x7b | ||
29 | ,0x52,0x28,0xc5,0x2a,0x4c,0x62,0xcb,0xd4 | ||
30 | ,0x4b,0x66,0x84,0x9b,0x64,0x24,0x4f,0xfc | ||
31 | ,0xe5,0xec,0xba,0xaf,0x33,0xbd,0x75,0x1a | ||
32 | ,0x1a,0xc7,0x28,0xd4,0x5e,0x6c,0x61,0x29 | ||
33 | ,0x6c,0xdc,0x3c,0x01,0x23,0x35,0x61,0xf4 | ||
34 | ,0x1d,0xb6,0x6c,0xce,0x31,0x4a,0xdb,0x31 | ||
35 | ,0x0e,0x3b,0xe8,0x25,0x0c,0x46,0xf0,0x6d | ||
36 | ,0xce,0xea,0x3a,0x7f,0xa1,0x34,0x80,0x57 | ||
37 | ,0xe2,0xf6,0x55,0x6a,0xd6,0xb1,0x31,0x8a | ||
38 | ,0x02,0x4a,0x83,0x8f,0x21,0xaf,0x1f,0xde | ||
39 | ,0x04,0x89,0x77,0xeb,0x48,0xf5,0x9f,0xfd | ||
40 | ,0x49,0x24,0xca,0x1c,0x60,0x90,0x2e,0x52 | ||
41 | ,0xf0,0xa0,0x89,0xbc,0x76,0x89,0x70,0x40 | ||
42 | ,0xe0,0x82,0xf9,0x37,0x76,0x38,0x48,0x64 | ||
43 | ,0x5e,0x07,0x05 | ||
44 | } ; | ||
45 | |||
46 | main() | ||
47 | { | ||
48 | int i; | ||
49 | string m(m_bytes,sizeof m_bytes); | ||
50 | string nonce(nonce_bytes,sizeof nonce_bytes); | ||
51 | string bobpk(bobpk_bytes,sizeof bobpk_bytes); | ||
52 | string alicesk(alicesk_bytes,sizeof alicesk_bytes); | ||
53 | string c = crypto_box_curve25519xsalsa20poly1305(m,nonce,bobpk,alicesk); | ||
54 | for (i = 0;i < c.size();++i) { | ||
55 | printf(",0x%02x",(unsigned int) (unsigned char) c[i]); | ||
56 | if (i % 8 == 7) printf("\n"); | ||
57 | } | ||
58 | printf("\n"); | ||
59 | return 0; | ||
60 | } | ||
diff --git a/nacl/tests/box3.out b/nacl/tests/box3.out deleted file mode 100644 index 2b6c51ea..00000000 --- a/nacl/tests/box3.out +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | ,0xf3,0xff,0xc7,0x70,0x3f,0x94,0x00,0xe5 | ||
2 | ,0x2a,0x7d,0xfb,0x4b,0x3d,0x33,0x05,0xd9 | ||
3 | ,0x8e,0x99,0x3b,0x9f,0x48,0x68,0x12,0x73 | ||
4 | ,0xc2,0x96,0x50,0xba,0x32,0xfc,0x76,0xce | ||
5 | ,0x48,0x33,0x2e,0xa7,0x16,0x4d,0x96,0xa4 | ||
6 | ,0x47,0x6f,0xb8,0xc5,0x31,0xa1,0x18,0x6a | ||
7 | ,0xc0,0xdf,0xc1,0x7c,0x98,0xdc,0xe8,0x7b | ||
8 | ,0x4d,0xa7,0xf0,0x11,0xec,0x48,0xc9,0x72 | ||
9 | ,0x71,0xd2,0xc2,0x0f,0x9b,0x92,0x8f,0xe2 | ||
10 | ,0x27,0x0d,0x6f,0xb8,0x63,0xd5,0x17,0x38 | ||
11 | ,0xb4,0x8e,0xee,0xe3,0x14,0xa7,0xcc,0x8a | ||
12 | ,0xb9,0x32,0x16,0x45,0x48,0xe5,0x26,0xae | ||
13 | ,0x90,0x22,0x43,0x68,0x51,0x7a,0xcf,0xea | ||
14 | ,0xbd,0x6b,0xb3,0x73,0x2b,0xc0,0xe9,0xda | ||
15 | ,0x99,0x83,0x2b,0x61,0xca,0x01,0xb6,0xde | ||
16 | ,0x56,0x24,0x4a,0x9e,0x88,0xd5,0xf9,0xb3 | ||
17 | ,0x79,0x73,0xf6,0x22,0xa4,0x3d,0x14,0xa6 | ||
18 | ,0x59,0x9b,0x1f,0x65,0x4c,0xb4,0x5a,0x74 | ||
19 | ,0xe3,0x55,0xa5 | ||
diff --git a/nacl/tests/box4.cpp b/nacl/tests/box4.cpp deleted file mode 100644 index 7f48fcd6..00000000 --- a/nacl/tests/box4.cpp +++ /dev/null | |||
@@ -1,66 +0,0 @@ | |||
1 | #include <string> | ||
2 | using std::string; | ||
3 | #include <stdio.h> | ||
4 | #include "crypto_box_curve25519xsalsa20poly1305.h" | ||
5 | |||
6 | char bobsk_bytes[32] = { | ||
7 | 0x5d,0xab,0x08,0x7e,0x62,0x4a,0x8a,0x4b | ||
8 | ,0x79,0xe1,0x7f,0x8b,0x83,0x80,0x0e,0xe6 | ||
9 | ,0x6f,0x3b,0xb1,0x29,0x26,0x18,0xb6,0xfd | ||
10 | ,0x1c,0x2f,0x8b,0x27,0xff,0x88,0xe0,0xeb | ||
11 | } ; | ||
12 | |||
13 | char alicepk_bytes[32] = { | ||
14 | 0x85,0x20,0xf0,0x09,0x89,0x30,0xa7,0x54 | ||
15 | ,0x74,0x8b,0x7d,0xdc,0xb4,0x3e,0xf7,0x5a | ||
16 | ,0x0d,0xbf,0x3a,0x0d,0x26,0x38,0x1a,0xf4 | ||
17 | ,0xeb,0xa4,0xa9,0x8e,0xaa,0x9b,0x4e,0x6a | ||
18 | } ; | ||
19 | |||
20 | char nonce_bytes[24] = { | ||
21 | 0x69,0x69,0x6e,0xe9,0x55,0xb6,0x2b,0x73 | ||
22 | ,0xcd,0x62,0xbd,0xa8,0x75,0xfc,0x73,0xd6 | ||
23 | ,0x82,0x19,0xe0,0x03,0x6b,0x7a,0x0b,0x37 | ||
24 | } ; | ||
25 | |||
26 | char c_bytes[147] = { | ||
27 | 0xf3,0xff,0xc7,0x70,0x3f,0x94,0x00,0xe5 | ||
28 | ,0x2a,0x7d,0xfb,0x4b,0x3d,0x33,0x05,0xd9 | ||
29 | ,0x8e,0x99,0x3b,0x9f,0x48,0x68,0x12,0x73 | ||
30 | ,0xc2,0x96,0x50,0xba,0x32,0xfc,0x76,0xce | ||
31 | ,0x48,0x33,0x2e,0xa7,0x16,0x4d,0x96,0xa4 | ||
32 | ,0x47,0x6f,0xb8,0xc5,0x31,0xa1,0x18,0x6a | ||
33 | ,0xc0,0xdf,0xc1,0x7c,0x98,0xdc,0xe8,0x7b | ||
34 | ,0x4d,0xa7,0xf0,0x11,0xec,0x48,0xc9,0x72 | ||
35 | ,0x71,0xd2,0xc2,0x0f,0x9b,0x92,0x8f,0xe2 | ||
36 | ,0x27,0x0d,0x6f,0xb8,0x63,0xd5,0x17,0x38 | ||
37 | ,0xb4,0x8e,0xee,0xe3,0x14,0xa7,0xcc,0x8a | ||
38 | ,0xb9,0x32,0x16,0x45,0x48,0xe5,0x26,0xae | ||
39 | ,0x90,0x22,0x43,0x68,0x51,0x7a,0xcf,0xea | ||
40 | ,0xbd,0x6b,0xb3,0x73,0x2b,0xc0,0xe9,0xda | ||
41 | ,0x99,0x83,0x2b,0x61,0xca,0x01,0xb6,0xde | ||
42 | ,0x56,0x24,0x4a,0x9e,0x88,0xd5,0xf9,0xb3 | ||
43 | ,0x79,0x73,0xf6,0x22,0xa4,0x3d,0x14,0xa6 | ||
44 | ,0x59,0x9b,0x1f,0x65,0x4c,0xb4,0x5a,0x74 | ||
45 | ,0xe3,0x55,0xa5 | ||
46 | } ; | ||
47 | |||
48 | main() | ||
49 | { | ||
50 | int i; | ||
51 | string c(c_bytes,sizeof c_bytes); | ||
52 | string nonce(nonce_bytes,sizeof nonce_bytes); | ||
53 | string alicepk(alicepk_bytes,sizeof alicepk_bytes); | ||
54 | string bobsk(bobsk_bytes,sizeof bobsk_bytes); | ||
55 | try { | ||
56 | string m = crypto_box_curve25519xsalsa20poly1305_open(c,nonce,alicepk,bobsk); | ||
57 | for (i = 0;i < m.size();++i) { | ||
58 | printf(",0x%02x",(unsigned int) (unsigned char) m[i]); | ||
59 | if (i % 8 == 7) printf("\n"); | ||
60 | } | ||
61 | printf("\n"); | ||
62 | } catch(const char *s) { | ||
63 | printf("%s\n",s); | ||
64 | } | ||
65 | return 0; | ||
66 | } | ||
diff --git a/nacl/tests/box4.out b/nacl/tests/box4.out deleted file mode 100644 index c61d4557..00000000 --- a/nacl/tests/box4.out +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | ,0xbe,0x07,0x5f,0xc5,0x3c,0x81,0xf2,0xd5 | ||
2 | ,0xcf,0x14,0x13,0x16,0xeb,0xeb,0x0c,0x7b | ||
3 | ,0x52,0x28,0xc5,0x2a,0x4c,0x62,0xcb,0xd4 | ||
4 | ,0x4b,0x66,0x84,0x9b,0x64,0x24,0x4f,0xfc | ||
5 | ,0xe5,0xec,0xba,0xaf,0x33,0xbd,0x75,0x1a | ||
6 | ,0x1a,0xc7,0x28,0xd4,0x5e,0x6c,0x61,0x29 | ||
7 | ,0x6c,0xdc,0x3c,0x01,0x23,0x35,0x61,0xf4 | ||
8 | ,0x1d,0xb6,0x6c,0xce,0x31,0x4a,0xdb,0x31 | ||
9 | ,0x0e,0x3b,0xe8,0x25,0x0c,0x46,0xf0,0x6d | ||
10 | ,0xce,0xea,0x3a,0x7f,0xa1,0x34,0x80,0x57 | ||
11 | ,0xe2,0xf6,0x55,0x6a,0xd6,0xb1,0x31,0x8a | ||
12 | ,0x02,0x4a,0x83,0x8f,0x21,0xaf,0x1f,0xde | ||
13 | ,0x04,0x89,0x77,0xeb,0x48,0xf5,0x9f,0xfd | ||
14 | ,0x49,0x24,0xca,0x1c,0x60,0x90,0x2e,0x52 | ||
15 | ,0xf0,0xa0,0x89,0xbc,0x76,0x89,0x70,0x40 | ||
16 | ,0xe0,0x82,0xf9,0x37,0x76,0x38,0x48,0x64 | ||
17 | ,0x5e,0x07,0x05 | ||
diff --git a/nacl/tests/box5.cpp b/nacl/tests/box5.cpp deleted file mode 100644 index 366e2e30..00000000 --- a/nacl/tests/box5.cpp +++ /dev/null | |||
@@ -1,30 +0,0 @@ | |||
1 | #include <string> | ||
2 | using std::string; | ||
3 | #include <stdio.h> | ||
4 | #include "crypto_box.h" | ||
5 | #include "randombytes.h" | ||
6 | |||
7 | main() | ||
8 | { | ||
9 | int mlen; | ||
10 | for (mlen = 0;mlen < 1000;++mlen) { | ||
11 | string alicesk; | ||
12 | string alicepk = crypto_box_keypair(&alicesk); | ||
13 | string bobsk; | ||
14 | string bobpk = crypto_box_keypair(&bobsk); | ||
15 | unsigned char nbytes[crypto_box_NONCEBYTES]; | ||
16 | randombytes(nbytes,crypto_box_NONCEBYTES); | ||
17 | string n((char *) nbytes,crypto_box_NONCEBYTES); | ||
18 | unsigned char mbytes[mlen]; | ||
19 | randombytes(mbytes,mlen); | ||
20 | string m((char *) mbytes,mlen); | ||
21 | string c = crypto_box(m,n,bobpk,alicesk); | ||
22 | try { | ||
23 | string m2 = crypto_box_open(c,n,alicepk,bobsk); | ||
24 | if (m != m2) printf("bad decryption\n"); | ||
25 | } catch(const char *s) { | ||
26 | printf("%s\n",s); | ||
27 | } | ||
28 | } | ||
29 | return 0; | ||
30 | } | ||
diff --git a/nacl/tests/box5.out b/nacl/tests/box5.out deleted file mode 100644 index e69de29b..00000000 --- a/nacl/tests/box5.out +++ /dev/null | |||
diff --git a/nacl/tests/box6.cpp b/nacl/tests/box6.cpp deleted file mode 100644 index bab18105..00000000 --- a/nacl/tests/box6.cpp +++ /dev/null | |||
@@ -1,43 +0,0 @@ | |||
1 | #include <string> | ||
2 | using std::string; | ||
3 | #include <stdlib.h> | ||
4 | #include <stdio.h> | ||
5 | #include "crypto_box.h" | ||
6 | #include "randombytes.h" | ||
7 | |||
8 | main() | ||
9 | { | ||
10 | int mlen; | ||
11 | for (mlen = 0;mlen < 1000;++mlen) { | ||
12 | string alicesk; | ||
13 | string alicepk = crypto_box_keypair(&alicesk); | ||
14 | string bobsk; | ||
15 | string bobpk = crypto_box_keypair(&bobsk); | ||
16 | unsigned char nbytes[crypto_box_NONCEBYTES]; | ||
17 | randombytes(nbytes,crypto_box_NONCEBYTES); | ||
18 | string n((char *) nbytes,crypto_box_NONCEBYTES); | ||
19 | unsigned char mbytes[mlen]; | ||
20 | randombytes(mbytes,mlen); | ||
21 | string m((char *) mbytes,mlen); | ||
22 | string c = crypto_box(m,n,bobpk,alicesk); | ||
23 | int caught = 0; | ||
24 | while (caught < 10) { | ||
25 | c.replace(random() % c.size(),1,1,random()); | ||
26 | try { | ||
27 | string m2 = crypto_box_open(c,n,alicepk,bobsk); | ||
28 | if (m != m2) { | ||
29 | printf("forgery\n"); | ||
30 | return 100; | ||
31 | } | ||
32 | } catch(const char *s) { | ||
33 | if (string(s) == string("ciphertext fails verification")) | ||
34 | ++caught; | ||
35 | else { | ||
36 | printf("%s\n",s); | ||
37 | return 111; | ||
38 | } | ||
39 | } | ||
40 | } | ||
41 | } | ||
42 | return 0; | ||
43 | } | ||
diff --git a/nacl/tests/box6.out b/nacl/tests/box6.out deleted file mode 100644 index e69de29b..00000000 --- a/nacl/tests/box6.out +++ /dev/null | |||
diff --git a/nacl/tests/box7.c b/nacl/tests/box7.c deleted file mode 100644 index 809301c1..00000000 --- a/nacl/tests/box7.c +++ /dev/null | |||
@@ -1,36 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | #include "crypto_box.h" | ||
3 | #include "randombytes.h" | ||
4 | |||
5 | unsigned char alicesk[crypto_box_SECRETKEYBYTES]; | ||
6 | unsigned char alicepk[crypto_box_PUBLICKEYBYTES]; | ||
7 | unsigned char bobsk[crypto_box_SECRETKEYBYTES]; | ||
8 | unsigned char bobpk[crypto_box_PUBLICKEYBYTES]; | ||
9 | unsigned char n[crypto_box_NONCEBYTES]; | ||
10 | unsigned char m[10000]; | ||
11 | unsigned char c[10000]; | ||
12 | unsigned char m2[10000]; | ||
13 | |||
14 | main() | ||
15 | { | ||
16 | int mlen; | ||
17 | int i; | ||
18 | |||
19 | for (mlen = 0;mlen < 1000 && mlen + crypto_box_ZEROBYTES < sizeof m;++mlen) { | ||
20 | crypto_box_keypair(alicepk,alicesk); | ||
21 | crypto_box_keypair(bobpk,bobsk); | ||
22 | randombytes(n,crypto_box_NONCEBYTES); | ||
23 | randombytes(m + crypto_box_ZEROBYTES,mlen); | ||
24 | crypto_box(c,m,mlen + crypto_box_ZEROBYTES,n,bobpk,alicesk); | ||
25 | if (crypto_box_open(m2,c,mlen + crypto_box_ZEROBYTES,n,alicepk,bobsk) == 0) { | ||
26 | for (i = 0;i < mlen + crypto_box_ZEROBYTES;++i) | ||
27 | if (m2[i] != m[i]) { | ||
28 | printf("bad decryption\n"); | ||
29 | break; | ||
30 | } | ||
31 | } else { | ||
32 | printf("ciphertext fails verification\n"); | ||
33 | } | ||
34 | } | ||
35 | return 0; | ||
36 | } | ||
diff --git a/nacl/tests/box7.out b/nacl/tests/box7.out deleted file mode 100644 index e69de29b..00000000 --- a/nacl/tests/box7.out +++ /dev/null | |||
diff --git a/nacl/tests/box8.c b/nacl/tests/box8.c deleted file mode 100644 index dac676ef..00000000 --- a/nacl/tests/box8.c +++ /dev/null | |||
@@ -1,41 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | #include "crypto_box.h" | ||
3 | #include "randombytes.h" | ||
4 | |||
5 | unsigned char alicesk[crypto_box_SECRETKEYBYTES]; | ||
6 | unsigned char alicepk[crypto_box_PUBLICKEYBYTES]; | ||
7 | unsigned char bobsk[crypto_box_SECRETKEYBYTES]; | ||
8 | unsigned char bobpk[crypto_box_PUBLICKEYBYTES]; | ||
9 | unsigned char n[crypto_box_NONCEBYTES]; | ||
10 | unsigned char m[10000]; | ||
11 | unsigned char c[10000]; | ||
12 | unsigned char m2[10000]; | ||
13 | |||
14 | main() | ||
15 | { | ||
16 | int mlen; | ||
17 | int i; | ||
18 | int caught; | ||
19 | |||
20 | for (mlen = 0;mlen < 1000 && mlen + crypto_box_ZEROBYTES < sizeof m;++mlen) { | ||
21 | crypto_box_keypair(alicepk,alicesk); | ||
22 | crypto_box_keypair(bobpk,bobsk); | ||
23 | randombytes(n,crypto_box_NONCEBYTES); | ||
24 | randombytes(m + crypto_box_ZEROBYTES,mlen); | ||
25 | crypto_box(c,m,mlen + crypto_box_ZEROBYTES,n,bobpk,alicesk); | ||
26 | caught = 0; | ||
27 | while (caught < 10) { | ||
28 | c[random() % (mlen + crypto_box_ZEROBYTES)] = random(); | ||
29 | if (crypto_box_open(m2,c,mlen + crypto_box_ZEROBYTES,n,alicepk,bobsk) == 0) { | ||
30 | for (i = 0;i < mlen + crypto_box_ZEROBYTES;++i) | ||
31 | if (m2[i] != m[i]) { | ||
32 | printf("forgery\n"); | ||
33 | return 100; | ||
34 | } | ||
35 | } else { | ||
36 | ++caught; | ||
37 | } | ||
38 | } | ||
39 | } | ||
40 | return 0; | ||
41 | } | ||
diff --git a/nacl/tests/box8.out b/nacl/tests/box8.out deleted file mode 100644 index e69de29b..00000000 --- a/nacl/tests/box8.out +++ /dev/null | |||
diff --git a/nacl/tests/core1.c b/nacl/tests/core1.c deleted file mode 100644 index 9a8fc51d..00000000 --- a/nacl/tests/core1.c +++ /dev/null | |||
@@ -1,30 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | #include "crypto_core_hsalsa20.h" | ||
3 | |||
4 | unsigned 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 | |||
11 | unsigned char zero[32] = { 0 }; | ||
12 | |||
13 | unsigned char c[16] = { | ||
14 | 0x65,0x78,0x70,0x61,0x6e,0x64,0x20,0x33 | ||
15 | ,0x32,0x2d,0x62,0x79,0x74,0x65,0x20,0x6b | ||
16 | } ; | ||
17 | |||
18 | unsigned char firstkey[32]; | ||
19 | |||
20 | main() | ||
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 | } | ||
diff --git a/nacl/tests/core1.out b/nacl/tests/core1.out deleted file mode 100644 index 715a489d..00000000 --- a/nacl/tests/core1.out +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | 0x1b,0x27,0x55,0x64,0x73,0xe9,0x85,0xd4 | ||
2 | ,0x62,0xcd,0x51,0x19,0x7a,0x9a,0x46,0xc7 | ||
3 | ,0x60,0x09,0x54,0x9e,0xac,0x64,0x74,0xf2 | ||
4 | ,0x06,0xc4,0xee,0x08,0x44,0xf6,0x83,0x89 | ||
diff --git a/nacl/tests/core2.c b/nacl/tests/core2.c deleted file mode 100644 index 08402285..00000000 --- a/nacl/tests/core2.c +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | #include "crypto_core_hsalsa20.h" | ||
3 | |||
4 | unsigned char firstkey[32] = { | ||
5 | 0x1b,0x27,0x55,0x64,0x73,0xe9,0x85,0xd4 | ||
6 | ,0x62,0xcd,0x51,0x19,0x7a,0x9a,0x46,0xc7 | ||
7 | ,0x60,0x09,0x54,0x9e,0xac,0x64,0x74,0xf2 | ||
8 | ,0x06,0xc4,0xee,0x08,0x44,0xf6,0x83,0x89 | ||
9 | } ; | ||
10 | |||
11 | unsigned char nonceprefix[16] = { | ||
12 | 0x69,0x69,0x6e,0xe9,0x55,0xb6,0x2b,0x73 | ||
13 | ,0xcd,0x62,0xbd,0xa8,0x75,0xfc,0x73,0xd6 | ||
14 | } ; | ||
15 | |||
16 | unsigned char c[16] = { | ||
17 | 0x65,0x78,0x70,0x61,0x6e,0x64,0x20,0x33 | ||
18 | ,0x32,0x2d,0x62,0x79,0x74,0x65,0x20,0x6b | ||
19 | } ; | ||
20 | |||
21 | unsigned char secondkey[32]; | ||
22 | |||
23 | main() | ||
24 | { | ||
25 | int i; | ||
26 | crypto_core_hsalsa20(secondkey,nonceprefix,firstkey,c); | ||
27 | for (i = 0;i < 32;++i) { | ||
28 | if (i > 0) printf(","); else printf(" "); | ||
29 | printf("0x%02x",(unsigned int) secondkey[i]); | ||
30 | if (i % 8 == 7) printf("\n"); | ||
31 | } | ||
32 | return 0; | ||
33 | } | ||
diff --git a/nacl/tests/core2.out b/nacl/tests/core2.out deleted file mode 100644 index f4682af0..00000000 --- a/nacl/tests/core2.out +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | 0xdc,0x90,0x8d,0xda,0x0b,0x93,0x44,0xa9 | ||
2 | ,0x53,0x62,0x9b,0x73,0x38,0x20,0x77,0x88 | ||
3 | ,0x80,0xf3,0xce,0xb4,0x21,0xbb,0x61,0xb9 | ||
4 | ,0x1c,0xbd,0x4c,0x3e,0x66,0x25,0x6c,0xe4 | ||
diff --git a/nacl/tests/core3.c b/nacl/tests/core3.c deleted file mode 100644 index 4c759a5b..00000000 --- a/nacl/tests/core3.c +++ /dev/null | |||
@@ -1,41 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | #include "crypto_core_salsa20.h" | ||
3 | #include "crypto_hash_sha256.h" | ||
4 | |||
5 | unsigned char secondkey[32] = { | ||
6 | 0xdc,0x90,0x8d,0xda,0x0b,0x93,0x44,0xa9 | ||
7 | ,0x53,0x62,0x9b,0x73,0x38,0x20,0x77,0x88 | ||
8 | ,0x80,0xf3,0xce,0xb4,0x21,0xbb,0x61,0xb9 | ||
9 | ,0x1c,0xbd,0x4c,0x3e,0x66,0x25,0x6c,0xe4 | ||
10 | } ; | ||
11 | |||
12 | unsigned char noncesuffix[8] = { | ||
13 | 0x82,0x19,0xe0,0x03,0x6b,0x7a,0x0b,0x37 | ||
14 | } ; | ||
15 | |||
16 | unsigned char c[16] = { | ||
17 | 0x65,0x78,0x70,0x61,0x6e,0x64,0x20,0x33 | ||
18 | ,0x32,0x2d,0x62,0x79,0x74,0x65,0x20,0x6b | ||
19 | } ; | ||
20 | |||
21 | unsigned char in[16] = { 0 } ; | ||
22 | |||
23 | unsigned char output[64 * 256 * 256]; | ||
24 | |||
25 | unsigned char h[32]; | ||
26 | |||
27 | main() | ||
28 | { | ||
29 | int i; | ||
30 | long long pos = 0; | ||
31 | for (i = 0;i < 8;++i) in[i] = noncesuffix[i]; | ||
32 | do { | ||
33 | do { | ||
34 | crypto_core_salsa20(output + pos,in,secondkey,c); | ||
35 | pos += 64; | ||
36 | } while (++in[8]); | ||
37 | } while (++in[9]); | ||
38 | crypto_hash_sha256(h,output,sizeof output); | ||
39 | for (i = 0;i < 32;++i) printf("%02x",h[i]); printf("\n"); | ||
40 | return 0; | ||
41 | } | ||
diff --git a/nacl/tests/core3.out b/nacl/tests/core3.out deleted file mode 100644 index 5fa208c1..00000000 --- a/nacl/tests/core3.out +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | 662b9d0e3463029156069b12f918691a98f7dfb2ca0393c96bbfc6b1fbd630a2 | ||
diff --git a/nacl/tests/core4.c b/nacl/tests/core4.c deleted file mode 100644 index 1f238c5e..00000000 --- a/nacl/tests/core4.c +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | #include "crypto_core_salsa20.h" | ||
3 | |||
4 | unsigned char k[32] = { | ||
5 | 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 | |||
11 | unsigned char in[16] = { | ||
12 | 101,102,103,104,105,106,107,108 | ||
13 | ,109,110,111,112,113,114,115,116 | ||
14 | } ; | ||
15 | |||
16 | unsigned char c[16] = { | ||
17 | 101,120,112, 97,110,100, 32, 51 | ||
18 | , 50, 45, 98,121,116,101, 32,107 | ||
19 | } ; | ||
20 | |||
21 | unsigned char out[64]; | ||
22 | |||
23 | main() | ||
24 | { | ||
25 | int i; | ||
26 | crypto_core_salsa20(out,in,k,c); | ||
27 | for (i = 0;i < 64;++i) { | ||
28 | if (i > 0) printf(","); else printf(" "); | ||
29 | printf("%3d",(unsigned int) out[i]); | ||
30 | if (i % 8 == 7) printf("\n"); | ||
31 | } | ||
32 | return 0; | ||
33 | } | ||
diff --git a/nacl/tests/core4.out b/nacl/tests/core4.out deleted file mode 100644 index d04e5b5e..00000000 --- a/nacl/tests/core4.out +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | 69, 37, 68, 39, 41, 15,107,193 | ||
2 | ,255,139,122, 6,170,233,217, 98 | ||
3 | , 89,144,182,106, 21, 51,200, 65 | ||
4 | ,239, 49,222, 34,215,114, 40,126 | ||
5 | ,104,197, 7,225,197,153, 31, 2 | ||
6 | ,102, 78, 76,176, 84,245,246,184 | ||
7 | ,177,160,133,130, 6, 72,149,119 | ||
8 | ,192,195,132,236,234,103,246, 74 | ||
diff --git a/nacl/tests/core5.c b/nacl/tests/core5.c deleted file mode 100644 index 6353477d..00000000 --- a/nacl/tests/core5.c +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | #include "crypto_core_hsalsa20.h" | ||
3 | |||
4 | unsigned char k[32] = { | ||
5 | 0xee,0x30,0x4f,0xca,0x27,0x00,0x8d,0x8c | ||
6 | ,0x12,0x6f,0x90,0x02,0x79,0x01,0xd8,0x0f | ||
7 | ,0x7f,0x1d,0x8b,0x8d,0xc9,0x36,0xcf,0x3b | ||
8 | ,0x9f,0x81,0x96,0x92,0x82,0x7e,0x57,0x77 | ||
9 | } ; | ||
10 | |||
11 | unsigned char in[16] = { | ||
12 | 0x81,0x91,0x8e,0xf2,0xa5,0xe0,0xda,0x9b | ||
13 | ,0x3e,0x90,0x60,0x52,0x1e,0x4b,0xb3,0x52 | ||
14 | } ; | ||
15 | |||
16 | unsigned char c[16] = { | ||
17 | 101,120,112, 97,110,100, 32, 51 | ||
18 | , 50, 45, 98,121,116,101, 32,107 | ||
19 | } ; | ||
20 | |||
21 | unsigned char out[32]; | ||
22 | |||
23 | main() | ||
24 | { | ||
25 | int i; | ||
26 | crypto_core_hsalsa20(out,in,k,c); | ||
27 | for (i = 0;i < 32;++i) { | ||
28 | printf(",0x%02x",(unsigned int) out[i]); | ||
29 | if (i % 8 == 7) printf("\n"); | ||
30 | } | ||
31 | return 0; | ||
32 | } | ||
diff --git a/nacl/tests/core5.out b/nacl/tests/core5.out deleted file mode 100644 index 562cf717..00000000 --- a/nacl/tests/core5.out +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | ,0xbc,0x1b,0x30,0xfc,0x07,0x2c,0xc1,0x40 | ||
2 | ,0x75,0xe4,0xba,0xa7,0x31,0xb5,0xa8,0x45 | ||
3 | ,0xea,0x9b,0x11,0xe9,0xa5,0x19,0x1f,0x94 | ||
4 | ,0xe1,0x8c,0xba,0x8f,0xd8,0x21,0xa7,0xcd | ||
diff --git a/nacl/tests/core6.c b/nacl/tests/core6.c deleted file mode 100644 index 67f35df9..00000000 --- a/nacl/tests/core6.c +++ /dev/null | |||
@@ -1,47 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | #include "crypto_core_salsa20.h" | ||
3 | |||
4 | unsigned char k[32] = { | ||
5 | 0xee,0x30,0x4f,0xca,0x27,0x00,0x8d,0x8c | ||
6 | ,0x12,0x6f,0x90,0x02,0x79,0x01,0xd8,0x0f | ||
7 | ,0x7f,0x1d,0x8b,0x8d,0xc9,0x36,0xcf,0x3b | ||
8 | ,0x9f,0x81,0x96,0x92,0x82,0x7e,0x57,0x77 | ||
9 | } ; | ||
10 | |||
11 | unsigned char in[16] = { | ||
12 | 0x81,0x91,0x8e,0xf2,0xa5,0xe0,0xda,0x9b | ||
13 | ,0x3e,0x90,0x60,0x52,0x1e,0x4b,0xb3,0x52 | ||
14 | } ; | ||
15 | |||
16 | unsigned char c[16] = { | ||
17 | 101,120,112, 97,110,100, 32, 51 | ||
18 | , 50, 45, 98,121,116,101, 32,107 | ||
19 | } ; | ||
20 | |||
21 | unsigned char out[64]; | ||
22 | |||
23 | void print(unsigned char *x,unsigned char *y) | ||
24 | { | ||
25 | int i; | ||
26 | unsigned int borrow = 0; | ||
27 | for (i = 0;i < 4;++i) { | ||
28 | unsigned int xi = x[i]; | ||
29 | unsigned int yi = y[i]; | ||
30 | printf(",0x%02x",255 & (xi - yi - borrow)); | ||
31 | borrow = (xi < yi + borrow); | ||
32 | } | ||
33 | } | ||
34 | |||
35 | main() | ||
36 | { | ||
37 | crypto_core_salsa20(out,in,k,c); | ||
38 | print(out,c); | ||
39 | print(out + 20,c + 4); printf("\n"); | ||
40 | print(out + 40,c + 8); | ||
41 | print(out + 60,c + 12); printf("\n"); | ||
42 | print(out + 24,in); | ||
43 | print(out + 28,in + 4); printf("\n"); | ||
44 | print(out + 32,in + 8); | ||
45 | print(out + 36,in + 12); printf("\n"); | ||
46 | return 0; | ||
47 | } | ||
diff --git a/nacl/tests/core6.out b/nacl/tests/core6.out deleted file mode 100644 index 562cf717..00000000 --- a/nacl/tests/core6.out +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | ,0xbc,0x1b,0x30,0xfc,0x07,0x2c,0xc1,0x40 | ||
2 | ,0x75,0xe4,0xba,0xa7,0x31,0xb5,0xa8,0x45 | ||
3 | ,0xea,0x9b,0x11,0xe9,0xa5,0x19,0x1f,0x94 | ||
4 | ,0xe1,0x8c,0xba,0x8f,0xd8,0x21,0xa7,0xcd | ||
diff --git a/nacl/tests/hash.c b/nacl/tests/hash.c deleted file mode 100644 index 8de470aa..00000000 --- a/nacl/tests/hash.c +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | #include "crypto_hash.h" | ||
3 | |||
4 | unsigned char x[8] = "testing\n"; | ||
5 | unsigned char h[crypto_hash_BYTES]; | ||
6 | |||
7 | int main() | ||
8 | { | ||
9 | int i; | ||
10 | crypto_hash(h,x,sizeof x); | ||
11 | for (i = 0;i < crypto_hash_BYTES;++i) printf("%02x",(unsigned int) h[i]); | ||
12 | printf("\n"); | ||
13 | return 0; | ||
14 | } | ||
diff --git a/nacl/tests/hash.out b/nacl/tests/hash.out deleted file mode 100644 index df582172..00000000 --- a/nacl/tests/hash.out +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | 24f950aac7b9ea9b3cb728228a0c82b67c39e96b4b344798870d5daee93e3ae5931baae8c7cacfea4b629452c38026a81d138bc7aad1af3ef7bfd5ec646d6c28 | ||
diff --git a/nacl/tests/hash2.cpp b/nacl/tests/hash2.cpp deleted file mode 100644 index 6594620d..00000000 --- a/nacl/tests/hash2.cpp +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | #include <iostream> | ||
2 | #include <string> | ||
3 | using std::string; | ||
4 | using std::cout; | ||
5 | using std::hex; | ||
6 | #include "crypto_hash.h" | ||
7 | |||
8 | int main() | ||
9 | { | ||
10 | string x = "testing\n"; | ||
11 | string h = crypto_hash(x); | ||
12 | for (int i = 0;i < h.size();++i) { | ||
13 | cout << hex << (15 & (int) (h[i] >> 4)); | ||
14 | cout << hex << (15 & (int) h[i]); | ||
15 | } | ||
16 | cout << "\n"; | ||
17 | return 0; | ||
18 | } | ||
diff --git a/nacl/tests/hash2.out b/nacl/tests/hash2.out deleted file mode 100644 index df582172..00000000 --- a/nacl/tests/hash2.out +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | 24f950aac7b9ea9b3cb728228a0c82b67c39e96b4b344798870d5daee93e3ae5931baae8c7cacfea4b629452c38026a81d138bc7aad1af3ef7bfd5ec646d6c28 | ||
diff --git a/nacl/tests/hash3.c b/nacl/tests/hash3.c deleted file mode 100644 index 10b89b90..00000000 --- a/nacl/tests/hash3.c +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | #include "crypto_hash_sha512.h" | ||
3 | |||
4 | unsigned char x[8] = "testing\n"; | ||
5 | unsigned char h[crypto_hash_sha512_BYTES]; | ||
6 | |||
7 | int main() | ||
8 | { | ||
9 | int i; | ||
10 | crypto_hash_sha512(h,x,sizeof x); | ||
11 | for (i = 0;i < crypto_hash_sha512_BYTES;++i) printf("%02x",(unsigned int) h[i]); | ||
12 | printf("\n"); | ||
13 | return 0; | ||
14 | } | ||
diff --git a/nacl/tests/hash3.out b/nacl/tests/hash3.out deleted file mode 100644 index df582172..00000000 --- a/nacl/tests/hash3.out +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | 24f950aac7b9ea9b3cb728228a0c82b67c39e96b4b344798870d5daee93e3ae5931baae8c7cacfea4b629452c38026a81d138bc7aad1af3ef7bfd5ec646d6c28 | ||
diff --git a/nacl/tests/hash4.cpp b/nacl/tests/hash4.cpp deleted file mode 100644 index 1d0a3f37..00000000 --- a/nacl/tests/hash4.cpp +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | #include <iostream> | ||
2 | #include <string> | ||
3 | using std::string; | ||
4 | using std::cout; | ||
5 | using std::hex; | ||
6 | #include "crypto_hash_sha512.h" | ||
7 | |||
8 | int main() | ||
9 | { | ||
10 | string x = "testing\n"; | ||
11 | string h = crypto_hash_sha512(x); | ||
12 | for (int i = 0;i < h.size();++i) { | ||
13 | cout << hex << (15 & (int) (h[i] >> 4)); | ||
14 | cout << hex << (15 & (int) h[i]); | ||
15 | } | ||
16 | cout << "\n"; | ||
17 | return 0; | ||
18 | } | ||
diff --git a/nacl/tests/hash4.out b/nacl/tests/hash4.out deleted file mode 100644 index df582172..00000000 --- a/nacl/tests/hash4.out +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | 24f950aac7b9ea9b3cb728228a0c82b67c39e96b4b344798870d5daee93e3ae5931baae8c7cacfea4b629452c38026a81d138bc7aad1af3ef7bfd5ec646d6c28 | ||
diff --git a/nacl/tests/onetimeauth.c b/nacl/tests/onetimeauth.c deleted file mode 100644 index 60a2df14..00000000 --- a/nacl/tests/onetimeauth.c +++ /dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | #include "crypto_onetimeauth_poly1305.h" | ||
3 | |||
4 | unsigned char rs[32] = { | ||
5 | 0xee,0xa6,0xa7,0x25,0x1c,0x1e,0x72,0x91 | ||
6 | ,0x6d,0x11,0xc2,0xcb,0x21,0x4d,0x3c,0x25 | ||
7 | ,0x25,0x39,0x12,0x1d,0x8e,0x23,0x4e,0x65 | ||
8 | ,0x2d,0x65,0x1f,0xa4,0xc8,0xcf,0xf8,0x80 | ||
9 | } ; | ||
10 | |||
11 | unsigned char c[131] = { | ||
12 | 0x8e,0x99,0x3b,0x9f,0x48,0x68,0x12,0x73 | ||
13 | ,0xc2,0x96,0x50,0xba,0x32,0xfc,0x76,0xce | ||
14 | ,0x48,0x33,0x2e,0xa7,0x16,0x4d,0x96,0xa4 | ||
15 | ,0x47,0x6f,0xb8,0xc5,0x31,0xa1,0x18,0x6a | ||
16 | ,0xc0,0xdf,0xc1,0x7c,0x98,0xdc,0xe8,0x7b | ||
17 | ,0x4d,0xa7,0xf0,0x11,0xec,0x48,0xc9,0x72 | ||
18 | ,0x71,0xd2,0xc2,0x0f,0x9b,0x92,0x8f,0xe2 | ||
19 | ,0x27,0x0d,0x6f,0xb8,0x63,0xd5,0x17,0x38 | ||
20 | ,0xb4,0x8e,0xee,0xe3,0x14,0xa7,0xcc,0x8a | ||
21 | ,0xb9,0x32,0x16,0x45,0x48,0xe5,0x26,0xae | ||
22 | ,0x90,0x22,0x43,0x68,0x51,0x7a,0xcf,0xea | ||
23 | ,0xbd,0x6b,0xb3,0x73,0x2b,0xc0,0xe9,0xda | ||
24 | ,0x99,0x83,0x2b,0x61,0xca,0x01,0xb6,0xde | ||
25 | ,0x56,0x24,0x4a,0x9e,0x88,0xd5,0xf9,0xb3 | ||
26 | ,0x79,0x73,0xf6,0x22,0xa4,0x3d,0x14,0xa6 | ||
27 | ,0x59,0x9b,0x1f,0x65,0x4c,0xb4,0x5a,0x74 | ||
28 | ,0xe3,0x55,0xa5 | ||
29 | } ; | ||
30 | |||
31 | unsigned char a[16]; | ||
32 | |||
33 | main() | ||
34 | { | ||
35 | int i; | ||
36 | crypto_onetimeauth_poly1305(a,c,131,rs); | ||
37 | for (i = 0;i < 16;++i) { | ||
38 | printf(",0x%02x",(unsigned int) a[i]); | ||
39 | if (i % 8 == 7) printf("\n"); | ||
40 | } | ||
41 | return 0; | ||
42 | } | ||
diff --git a/nacl/tests/onetimeauth.out b/nacl/tests/onetimeauth.out deleted file mode 100644 index 6d914615..00000000 --- a/nacl/tests/onetimeauth.out +++ /dev/null | |||
@@ -1,2 +0,0 @@ | |||
1 | ,0xf3,0xff,0xc7,0x70,0x3f,0x94,0x00,0xe5 | ||
2 | ,0x2a,0x7d,0xfb,0x4b,0x3d,0x33,0x05,0xd9 | ||
diff --git a/nacl/tests/onetimeauth2.c b/nacl/tests/onetimeauth2.c deleted file mode 100644 index 64c1a9cd..00000000 --- a/nacl/tests/onetimeauth2.c +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | #include "crypto_onetimeauth_poly1305.h" | ||
3 | |||
4 | unsigned char rs[32] = { | ||
5 | 0xee,0xa6,0xa7,0x25,0x1c,0x1e,0x72,0x91 | ||
6 | ,0x6d,0x11,0xc2,0xcb,0x21,0x4d,0x3c,0x25 | ||
7 | ,0x25,0x39,0x12,0x1d,0x8e,0x23,0x4e,0x65 | ||
8 | ,0x2d,0x65,0x1f,0xa4,0xc8,0xcf,0xf8,0x80 | ||
9 | } ; | ||
10 | |||
11 | unsigned char c[131] = { | ||
12 | 0x8e,0x99,0x3b,0x9f,0x48,0x68,0x12,0x73 | ||
13 | ,0xc2,0x96,0x50,0xba,0x32,0xfc,0x76,0xce | ||
14 | ,0x48,0x33,0x2e,0xa7,0x16,0x4d,0x96,0xa4 | ||
15 | ,0x47,0x6f,0xb8,0xc5,0x31,0xa1,0x18,0x6a | ||
16 | ,0xc0,0xdf,0xc1,0x7c,0x98,0xdc,0xe8,0x7b | ||
17 | ,0x4d,0xa7,0xf0,0x11,0xec,0x48,0xc9,0x72 | ||
18 | ,0x71,0xd2,0xc2,0x0f,0x9b,0x92,0x8f,0xe2 | ||
19 | ,0x27,0x0d,0x6f,0xb8,0x63,0xd5,0x17,0x38 | ||
20 | ,0xb4,0x8e,0xee,0xe3,0x14,0xa7,0xcc,0x8a | ||
21 | ,0xb9,0x32,0x16,0x45,0x48,0xe5,0x26,0xae | ||
22 | ,0x90,0x22,0x43,0x68,0x51,0x7a,0xcf,0xea | ||
23 | ,0xbd,0x6b,0xb3,0x73,0x2b,0xc0,0xe9,0xda | ||
24 | ,0x99,0x83,0x2b,0x61,0xca,0x01,0xb6,0xde | ||
25 | ,0x56,0x24,0x4a,0x9e,0x88,0xd5,0xf9,0xb3 | ||
26 | ,0x79,0x73,0xf6,0x22,0xa4,0x3d,0x14,0xa6 | ||
27 | ,0x59,0x9b,0x1f,0x65,0x4c,0xb4,0x5a,0x74 | ||
28 | ,0xe3,0x55,0xa5 | ||
29 | } ; | ||
30 | |||
31 | unsigned char a[16] = { | ||
32 | 0xf3,0xff,0xc7,0x70,0x3f,0x94,0x00,0xe5 | ||
33 | ,0x2a,0x7d,0xfb,0x4b,0x3d,0x33,0x05,0xd9 | ||
34 | } ; | ||
35 | |||
36 | main() | ||
37 | { | ||
38 | printf("%d\n",crypto_onetimeauth_poly1305_verify(a,c,131,rs)); | ||
39 | return 0; | ||
40 | } | ||
diff --git a/nacl/tests/onetimeauth2.out b/nacl/tests/onetimeauth2.out deleted file mode 100644 index 573541ac..00000000 --- a/nacl/tests/onetimeauth2.out +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | 0 | ||
diff --git a/nacl/tests/onetimeauth5.cpp b/nacl/tests/onetimeauth5.cpp deleted file mode 100644 index 884892ac..00000000 --- a/nacl/tests/onetimeauth5.cpp +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | #include <string> | ||
2 | using std::string; | ||
3 | #include <stdio.h> | ||
4 | #include "crypto_onetimeauth_poly1305.h" | ||
5 | |||
6 | char rs_bytes[32] = { | ||
7 | 0xee,0xa6,0xa7,0x25,0x1c,0x1e,0x72,0x91 | ||
8 | ,0x6d,0x11,0xc2,0xcb,0x21,0x4d,0x3c,0x25 | ||
9 | ,0x25,0x39,0x12,0x1d,0x8e,0x23,0x4e,0x65 | ||
10 | ,0x2d,0x65,0x1f,0xa4,0xc8,0xcf,0xf8,0x80 | ||
11 | } ; | ||
12 | |||
13 | char c_bytes[131] = { | ||
14 | 0x8e,0x99,0x3b,0x9f,0x48,0x68,0x12,0x73 | ||
15 | ,0xc2,0x96,0x50,0xba,0x32,0xfc,0x76,0xce | ||
16 | ,0x48,0x33,0x2e,0xa7,0x16,0x4d,0x96,0xa4 | ||
17 | ,0x47,0x6f,0xb8,0xc5,0x31,0xa1,0x18,0x6a | ||
18 | ,0xc0,0xdf,0xc1,0x7c,0x98,0xdc,0xe8,0x7b | ||
19 | ,0x4d,0xa7,0xf0,0x11,0xec,0x48,0xc9,0x72 | ||
20 | ,0x71,0xd2,0xc2,0x0f,0x9b,0x92,0x8f,0xe2 | ||
21 | ,0x27,0x0d,0x6f,0xb8,0x63,0xd5,0x17,0x38 | ||
22 | ,0xb4,0x8e,0xee,0xe3,0x14,0xa7,0xcc,0x8a | ||
23 | ,0xb9,0x32,0x16,0x45,0x48,0xe5,0x26,0xae | ||
24 | ,0x90,0x22,0x43,0x68,0x51,0x7a,0xcf,0xea | ||
25 | ,0xbd,0x6b,0xb3,0x73,0x2b,0xc0,0xe9,0xda | ||
26 | ,0x99,0x83,0x2b,0x61,0xca,0x01,0xb6,0xde | ||
27 | ,0x56,0x24,0x4a,0x9e,0x88,0xd5,0xf9,0xb3 | ||
28 | ,0x79,0x73,0xf6,0x22,0xa4,0x3d,0x14,0xa6 | ||
29 | ,0x59,0x9b,0x1f,0x65,0x4c,0xb4,0x5a,0x74 | ||
30 | ,0xe3,0x55,0xa5 | ||
31 | } ; | ||
32 | |||
33 | unsigned char a[16]; | ||
34 | |||
35 | main() | ||
36 | { | ||
37 | int i; | ||
38 | string c(c_bytes,sizeof c_bytes); | ||
39 | string rs(rs_bytes,sizeof rs_bytes); | ||
40 | string a = crypto_onetimeauth_poly1305(c,rs); | ||
41 | for (i = 0;i < a.size();++i) { | ||
42 | printf(",0x%02x",(unsigned int) (unsigned char) a[i]); | ||
43 | if (i % 8 == 7) printf("\n"); | ||
44 | } | ||
45 | return 0; | ||
46 | } | ||
diff --git a/nacl/tests/onetimeauth5.out b/nacl/tests/onetimeauth5.out deleted file mode 100644 index 6d914615..00000000 --- a/nacl/tests/onetimeauth5.out +++ /dev/null | |||
@@ -1,2 +0,0 @@ | |||
1 | ,0xf3,0xff,0xc7,0x70,0x3f,0x94,0x00,0xe5 | ||
2 | ,0x2a,0x7d,0xfb,0x4b,0x3d,0x33,0x05,0xd9 | ||
diff --git a/nacl/tests/onetimeauth6.cpp b/nacl/tests/onetimeauth6.cpp deleted file mode 100644 index d79d4613..00000000 --- a/nacl/tests/onetimeauth6.cpp +++ /dev/null | |||
@@ -1,50 +0,0 @@ | |||
1 | #include <string> | ||
2 | using std::string; | ||
3 | #include <stdio.h> | ||
4 | #include "crypto_onetimeauth_poly1305.h" | ||
5 | |||
6 | char rs_bytes[32] = { | ||
7 | 0xee,0xa6,0xa7,0x25,0x1c,0x1e,0x72,0x91 | ||
8 | ,0x6d,0x11,0xc2,0xcb,0x21,0x4d,0x3c,0x25 | ||
9 | ,0x25,0x39,0x12,0x1d,0x8e,0x23,0x4e,0x65 | ||
10 | ,0x2d,0x65,0x1f,0xa4,0xc8,0xcf,0xf8,0x80 | ||
11 | } ; | ||
12 | |||
13 | char c_bytes[131] = { | ||
14 | 0x8e,0x99,0x3b,0x9f,0x48,0x68,0x12,0x73 | ||
15 | ,0xc2,0x96,0x50,0xba,0x32,0xfc,0x76,0xce | ||
16 | ,0x48,0x33,0x2e,0xa7,0x16,0x4d,0x96,0xa4 | ||
17 | ,0x47,0x6f,0xb8,0xc5,0x31,0xa1,0x18,0x6a | ||
18 | ,0xc0,0xdf,0xc1,0x7c,0x98,0xdc,0xe8,0x7b | ||
19 | ,0x4d,0xa7,0xf0,0x11,0xec,0x48,0xc9,0x72 | ||
20 | ,0x71,0xd2,0xc2,0x0f,0x9b,0x92,0x8f,0xe2 | ||
21 | ,0x27,0x0d,0x6f,0xb8,0x63,0xd5,0x17,0x38 | ||
22 | ,0xb4,0x8e,0xee,0xe3,0x14,0xa7,0xcc,0x8a | ||
23 | ,0xb9,0x32,0x16,0x45,0x48,0xe5,0x26,0xae | ||
24 | ,0x90,0x22,0x43,0x68,0x51,0x7a,0xcf,0xea | ||
25 | ,0xbd,0x6b,0xb3,0x73,0x2b,0xc0,0xe9,0xda | ||
26 | ,0x99,0x83,0x2b,0x61,0xca,0x01,0xb6,0xde | ||
27 | ,0x56,0x24,0x4a,0x9e,0x88,0xd5,0xf9,0xb3 | ||
28 | ,0x79,0x73,0xf6,0x22,0xa4,0x3d,0x14,0xa6 | ||
29 | ,0x59,0x9b,0x1f,0x65,0x4c,0xb4,0x5a,0x74 | ||
30 | ,0xe3,0x55,0xa5 | ||
31 | } ; | ||
32 | |||
33 | char a_bytes[16] = { | ||
34 | 0xf3,0xff,0xc7,0x70,0x3f,0x94,0x00,0xe5 | ||
35 | ,0x2a,0x7d,0xfb,0x4b,0x3d,0x33,0x05,0xd9 | ||
36 | } ; | ||
37 | |||
38 | main() | ||
39 | { | ||
40 | string rs(rs_bytes,sizeof rs_bytes); | ||
41 | string c(c_bytes,sizeof c_bytes); | ||
42 | string a(a_bytes,sizeof a_bytes); | ||
43 | try { | ||
44 | crypto_onetimeauth_poly1305_verify(a,c,rs); | ||
45 | printf("0\n"); | ||
46 | } catch(const char *s) { | ||
47 | printf("%s\n",s); | ||
48 | } | ||
49 | return 0; | ||
50 | } | ||
diff --git a/nacl/tests/onetimeauth6.out b/nacl/tests/onetimeauth6.out deleted file mode 100644 index 573541ac..00000000 --- a/nacl/tests/onetimeauth6.out +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | 0 | ||
diff --git a/nacl/tests/onetimeauth7.c b/nacl/tests/onetimeauth7.c deleted file mode 100644 index 349b8751..00000000 --- a/nacl/tests/onetimeauth7.c +++ /dev/null | |||
@@ -1,36 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | #include <stdlib.h> | ||
3 | #include "crypto_onetimeauth_poly1305.h" | ||
4 | #include "randombytes.h" | ||
5 | |||
6 | unsigned char key[32]; | ||
7 | unsigned char c[10000]; | ||
8 | unsigned char a[16]; | ||
9 | |||
10 | main() | ||
11 | { | ||
12 | int clen; | ||
13 | int i; | ||
14 | for (clen = 0;clen < 10000;++clen) { | ||
15 | randombytes(key,sizeof key); | ||
16 | randombytes(c,clen); | ||
17 | crypto_onetimeauth_poly1305(a,c,clen,key); | ||
18 | if (crypto_onetimeauth_poly1305_verify(a,c,clen,key) != 0) { | ||
19 | printf("fail %d\n",clen); | ||
20 | return 100; | ||
21 | } | ||
22 | if (clen > 0) { | ||
23 | c[random() % clen] += 1 + (random() % 255); | ||
24 | if (crypto_onetimeauth_poly1305_verify(a,c,clen,key) == 0) { | ||
25 | printf("forgery %d\n",clen); | ||
26 | return 100; | ||
27 | } | ||
28 | a[random() % sizeof a] += 1 + (random() % 255); | ||
29 | if (crypto_onetimeauth_poly1305_verify(a,c,clen,key) == 0) { | ||
30 | printf("forgery %d\n",clen); | ||
31 | return 100; | ||
32 | } | ||
33 | } | ||
34 | } | ||
35 | return 0; | ||
36 | } | ||
diff --git a/nacl/tests/onetimeauth7.out b/nacl/tests/onetimeauth7.out deleted file mode 100644 index e69de29b..00000000 --- a/nacl/tests/onetimeauth7.out +++ /dev/null | |||
diff --git a/nacl/tests/onetimeauth8.cpp b/nacl/tests/onetimeauth8.cpp deleted file mode 100644 index ce554fb4..00000000 --- a/nacl/tests/onetimeauth8.cpp +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | #include <string> | ||
2 | using std::string; | ||
3 | #include <stdio.h> | ||
4 | #include <stdlib.h> | ||
5 | #include "crypto_onetimeauth_poly1305.h" | ||
6 | #include "randombytes.h" | ||
7 | |||
8 | main() | ||
9 | { | ||
10 | int clen; | ||
11 | int i; | ||
12 | for (clen = 0;clen < 10000;++clen) { | ||
13 | unsigned char key_bytes[32]; | ||
14 | randombytes(key_bytes,sizeof key_bytes); | ||
15 | string key((char *) key_bytes,sizeof key_bytes); | ||
16 | unsigned char c_bytes[clen]; | ||
17 | randombytes(c_bytes,sizeof c_bytes); | ||
18 | string c((char *) c_bytes,sizeof c_bytes); | ||
19 | string a = crypto_onetimeauth_poly1305(c,key); | ||
20 | try { | ||
21 | crypto_onetimeauth_poly1305_verify(a,c,key); | ||
22 | } catch(const char *s) { | ||
23 | printf("fail %d %s\n",clen,s); | ||
24 | return 100; | ||
25 | } | ||
26 | if (clen > 0) { | ||
27 | size_t pos = random() % clen; | ||
28 | c.replace(pos,1,1,c[pos] + 1 + (random() % 255)); | ||
29 | try { | ||
30 | crypto_onetimeauth_poly1305_verify(a,c,key); | ||
31 | printf("forgery %d\n",clen); | ||
32 | } catch(const char *s) { | ||
33 | ; | ||
34 | } | ||
35 | pos = random() % a.size(); | ||
36 | a.replace(pos,1,1,a[pos] + 1 + (random() % 255)); | ||
37 | try { | ||
38 | crypto_onetimeauth_poly1305_verify(a,c,key); | ||
39 | printf("forgery %d\n",clen); | ||
40 | } catch(const char *s) { | ||
41 | ; | ||
42 | } | ||
43 | } | ||
44 | } | ||
45 | return 0; | ||
46 | } | ||
diff --git a/nacl/tests/onetimeauth8.out b/nacl/tests/onetimeauth8.out deleted file mode 100644 index e69de29b..00000000 --- a/nacl/tests/onetimeauth8.out +++ /dev/null | |||
diff --git a/nacl/tests/scalarmult.c b/nacl/tests/scalarmult.c deleted file mode 100644 index d9265954..00000000 --- a/nacl/tests/scalarmult.c +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | #include "crypto_scalarmult_curve25519.h" | ||
3 | |||
4 | unsigned char alicesk[32] = { | ||
5 | 0x77,0x07,0x6d,0x0a,0x73,0x18,0xa5,0x7d | ||
6 | ,0x3c,0x16,0xc1,0x72,0x51,0xb2,0x66,0x45 | ||
7 | ,0xdf,0x4c,0x2f,0x87,0xeb,0xc0,0x99,0x2a | ||
8 | ,0xb1,0x77,0xfb,0xa5,0x1d,0xb9,0x2c,0x2a | ||
9 | } ; | ||
10 | |||
11 | unsigned char alicepk[32]; | ||
12 | |||
13 | main() | ||
14 | { | ||
15 | int i; | ||
16 | crypto_scalarmult_curve25519_base(alicepk,alicesk); | ||
17 | for (i = 0;i < 32;++i) { | ||
18 | if (i > 0) printf(","); else printf(" "); | ||
19 | printf("0x%02x",(unsigned int) alicepk[i]); | ||
20 | if (i % 8 == 7) printf("\n"); | ||
21 | } | ||
22 | return 0; | ||
23 | } | ||
diff --git a/nacl/tests/scalarmult.out b/nacl/tests/scalarmult.out deleted file mode 100644 index ddd130d6..00000000 --- a/nacl/tests/scalarmult.out +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | 0x85,0x20,0xf0,0x09,0x89,0x30,0xa7,0x54 | ||
2 | ,0x74,0x8b,0x7d,0xdc,0xb4,0x3e,0xf7,0x5a | ||
3 | ,0x0d,0xbf,0x3a,0x0d,0x26,0x38,0x1a,0xf4 | ||
4 | ,0xeb,0xa4,0xa9,0x8e,0xaa,0x9b,0x4e,0x6a | ||
diff --git a/nacl/tests/scalarmult2.c b/nacl/tests/scalarmult2.c deleted file mode 100644 index 90e6360d..00000000 --- a/nacl/tests/scalarmult2.c +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | #include "crypto_scalarmult_curve25519.h" | ||
3 | |||
4 | unsigned char bobsk[32] = { | ||
5 | 0x5d,0xab,0x08,0x7e,0x62,0x4a,0x8a,0x4b | ||
6 | ,0x79,0xe1,0x7f,0x8b,0x83,0x80,0x0e,0xe6 | ||
7 | ,0x6f,0x3b,0xb1,0x29,0x26,0x18,0xb6,0xfd | ||
8 | ,0x1c,0x2f,0x8b,0x27,0xff,0x88,0xe0,0xeb | ||
9 | } ; | ||
10 | |||
11 | unsigned char bobpk[32]; | ||
12 | |||
13 | main() | ||
14 | { | ||
15 | int i; | ||
16 | crypto_scalarmult_curve25519_base(bobpk,bobsk); | ||
17 | for (i = 0;i < 32;++i) { | ||
18 | if (i > 0) printf(","); else printf(" "); | ||
19 | printf("0x%02x",(unsigned int) bobpk[i]); | ||
20 | if (i % 8 == 7) printf("\n"); | ||
21 | } | ||
22 | return 0; | ||
23 | } | ||
diff --git a/nacl/tests/scalarmult2.out b/nacl/tests/scalarmult2.out deleted file mode 100644 index b5391865..00000000 --- a/nacl/tests/scalarmult2.out +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | 0xde,0x9e,0xdb,0x7d,0x7b,0x7d,0xc1,0xb4 | ||
2 | ,0xd3,0x5b,0x61,0xc2,0xec,0xe4,0x35,0x37 | ||
3 | ,0x3f,0x83,0x43,0xc8,0x5b,0x78,0x67,0x4d | ||
4 | ,0xad,0xfc,0x7e,0x14,0x6f,0x88,0x2b,0x4f | ||
diff --git a/nacl/tests/scalarmult3.cpp b/nacl/tests/scalarmult3.cpp deleted file mode 100644 index 4e8fef3d..00000000 --- a/nacl/tests/scalarmult3.cpp +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | #include <iostream> | ||
2 | #include <iomanip> | ||
3 | #include <string> | ||
4 | using std::string; | ||
5 | using std::cout; | ||
6 | using std::setfill; | ||
7 | using std::setw; | ||
8 | using std::hex; | ||
9 | #include "crypto_scalarmult_curve25519.h" | ||
10 | |||
11 | char alicesk_bytes[32] = { | ||
12 | 0x77,0x07,0x6d,0x0a,0x73,0x18,0xa5,0x7d | ||
13 | ,0x3c,0x16,0xc1,0x72,0x51,0xb2,0x66,0x45 | ||
14 | ,0xdf,0x4c,0x2f,0x87,0xeb,0xc0,0x99,0x2a | ||
15 | ,0xb1,0x77,0xfb,0xa5,0x1d,0xb9,0x2c,0x2a | ||
16 | } ; | ||
17 | |||
18 | main() | ||
19 | { | ||
20 | int i; | ||
21 | cout << setfill('0'); | ||
22 | string alicesk(alicesk_bytes,sizeof alicesk_bytes); | ||
23 | string alicepk = crypto_scalarmult_curve25519_base(alicesk); | ||
24 | for (i = 0;i < alicepk.size();++i) { | ||
25 | unsigned char c = alicepk[i]; | ||
26 | if (i > 0) cout << ","; else cout << " "; | ||
27 | cout << "0x" << hex << setw(2) << (unsigned int) c; | ||
28 | if (i % 8 == 7) cout << "\n"; | ||
29 | } | ||
30 | return 0; | ||
31 | } | ||
diff --git a/nacl/tests/scalarmult3.out b/nacl/tests/scalarmult3.out deleted file mode 100644 index ddd130d6..00000000 --- a/nacl/tests/scalarmult3.out +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | 0x85,0x20,0xf0,0x09,0x89,0x30,0xa7,0x54 | ||
2 | ,0x74,0x8b,0x7d,0xdc,0xb4,0x3e,0xf7,0x5a | ||
3 | ,0x0d,0xbf,0x3a,0x0d,0x26,0x38,0x1a,0xf4 | ||
4 | ,0xeb,0xa4,0xa9,0x8e,0xaa,0x9b,0x4e,0x6a | ||
diff --git a/nacl/tests/scalarmult4.cpp b/nacl/tests/scalarmult4.cpp deleted file mode 100644 index 8e4d64e9..00000000 --- a/nacl/tests/scalarmult4.cpp +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | #include <iostream> | ||
2 | #include <iomanip> | ||
3 | #include <string> | ||
4 | using std::string; | ||
5 | using std::cout; | ||
6 | using std::setfill; | ||
7 | using std::setw; | ||
8 | using std::hex; | ||
9 | #include "crypto_scalarmult_curve25519.h" | ||
10 | |||
11 | char bobsk_bytes[32] = { | ||
12 | 0x5d,0xab,0x08,0x7e,0x62,0x4a,0x8a,0x4b | ||
13 | ,0x79,0xe1,0x7f,0x8b,0x83,0x80,0x0e,0xe6 | ||
14 | ,0x6f,0x3b,0xb1,0x29,0x26,0x18,0xb6,0xfd | ||
15 | ,0x1c,0x2f,0x8b,0x27,0xff,0x88,0xe0,0xeb | ||
16 | } ; | ||
17 | |||
18 | main() | ||
19 | { | ||
20 | int i; | ||
21 | cout << setfill('0'); | ||
22 | string bobsk(bobsk_bytes,sizeof bobsk_bytes); | ||
23 | string bobpk = crypto_scalarmult_curve25519_base(bobsk); | ||
24 | for (i = 0;i < bobpk.size();++i) { | ||
25 | unsigned char c = bobpk[i]; | ||
26 | if (i > 0) cout << ","; else cout << " "; | ||
27 | cout << "0x" << hex << setw(2) << (unsigned int) c; | ||
28 | if (i % 8 == 7) cout << "\n"; | ||
29 | } | ||
30 | return 0; | ||
31 | } | ||
diff --git a/nacl/tests/scalarmult4.out b/nacl/tests/scalarmult4.out deleted file mode 100644 index b5391865..00000000 --- a/nacl/tests/scalarmult4.out +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | 0xde,0x9e,0xdb,0x7d,0x7b,0x7d,0xc1,0xb4 | ||
2 | ,0xd3,0x5b,0x61,0xc2,0xec,0xe4,0x35,0x37 | ||
3 | ,0x3f,0x83,0x43,0xc8,0x5b,0x78,0x67,0x4d | ||
4 | ,0xad,0xfc,0x7e,0x14,0x6f,0x88,0x2b,0x4f | ||
diff --git a/nacl/tests/scalarmult5.c b/nacl/tests/scalarmult5.c deleted file mode 100644 index 14f8159d..00000000 --- a/nacl/tests/scalarmult5.c +++ /dev/null | |||
@@ -1,30 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | #include "crypto_scalarmult_curve25519.h" | ||
3 | |||
4 | unsigned char alicesk[32] = { | ||
5 | 0x77,0x07,0x6d,0x0a,0x73,0x18,0xa5,0x7d | ||
6 | ,0x3c,0x16,0xc1,0x72,0x51,0xb2,0x66,0x45 | ||
7 | ,0xdf,0x4c,0x2f,0x87,0xeb,0xc0,0x99,0x2a | ||
8 | ,0xb1,0x77,0xfb,0xa5,0x1d,0xb9,0x2c,0x2a | ||
9 | } ; | ||
10 | |||
11 | unsigned char bobpk[32] = { | ||
12 | 0xde,0x9e,0xdb,0x7d,0x7b,0x7d,0xc1,0xb4 | ||
13 | ,0xd3,0x5b,0x61,0xc2,0xec,0xe4,0x35,0x37 | ||
14 | ,0x3f,0x83,0x43,0xc8,0x5b,0x78,0x67,0x4d | ||
15 | ,0xad,0xfc,0x7e,0x14,0x6f,0x88,0x2b,0x4f | ||
16 | } ; | ||
17 | |||
18 | unsigned char k[32]; | ||
19 | |||
20 | main() | ||
21 | { | ||
22 | int i; | ||
23 | crypto_scalarmult_curve25519(k,alicesk,bobpk); | ||
24 | for (i = 0;i < 32;++i) { | ||
25 | if (i > 0) printf(","); else printf(" "); | ||
26 | printf("0x%02x",(unsigned int) k[i]); | ||
27 | if (i % 8 == 7) printf("\n"); | ||
28 | } | ||
29 | return 0; | ||
30 | } | ||
diff --git a/nacl/tests/scalarmult5.out b/nacl/tests/scalarmult5.out deleted file mode 100644 index bec21130..00000000 --- a/nacl/tests/scalarmult5.out +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | 0x4a,0x5d,0x9d,0x5b,0xa4,0xce,0x2d,0xe1 | ||
2 | ,0x72,0x8e,0x3b,0xf4,0x80,0x35,0x0f,0x25 | ||
3 | ,0xe0,0x7e,0x21,0xc9,0x47,0xd1,0x9e,0x33 | ||
4 | ,0x76,0xf0,0x9b,0x3c,0x1e,0x16,0x17,0x42 | ||
diff --git a/nacl/tests/scalarmult6.c b/nacl/tests/scalarmult6.c deleted file mode 100644 index 89bf9bdd..00000000 --- a/nacl/tests/scalarmult6.c +++ /dev/null | |||
@@ -1,30 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | #include "crypto_scalarmult_curve25519.h" | ||
3 | |||
4 | unsigned char bobsk[32] = { | ||
5 | 0x5d,0xab,0x08,0x7e,0x62,0x4a,0x8a,0x4b | ||
6 | ,0x79,0xe1,0x7f,0x8b,0x83,0x80,0x0e,0xe6 | ||
7 | ,0x6f,0x3b,0xb1,0x29,0x26,0x18,0xb6,0xfd | ||
8 | ,0x1c,0x2f,0x8b,0x27,0xff,0x88,0xe0,0xeb | ||
9 | } ; | ||
10 | |||
11 | unsigned char alicepk[32] = { | ||
12 | 0x85,0x20,0xf0,0x09,0x89,0x30,0xa7,0x54 | ||
13 | ,0x74,0x8b,0x7d,0xdc,0xb4,0x3e,0xf7,0x5a | ||
14 | ,0x0d,0xbf,0x3a,0x0d,0x26,0x38,0x1a,0xf4 | ||
15 | ,0xeb,0xa4,0xa9,0x8e,0xaa,0x9b,0x4e,0x6a | ||
16 | } ; | ||
17 | |||
18 | unsigned char k[32]; | ||
19 | |||
20 | main() | ||
21 | { | ||
22 | int i; | ||
23 | crypto_scalarmult_curve25519(k,bobsk,alicepk); | ||
24 | for (i = 0;i < 32;++i) { | ||
25 | if (i > 0) printf(","); else printf(" "); | ||
26 | printf("0x%02x",(unsigned int) k[i]); | ||
27 | if (i % 8 == 7) printf("\n"); | ||
28 | } | ||
29 | return 0; | ||
30 | } | ||
diff --git a/nacl/tests/scalarmult6.out b/nacl/tests/scalarmult6.out deleted file mode 100644 index bec21130..00000000 --- a/nacl/tests/scalarmult6.out +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | 0x4a,0x5d,0x9d,0x5b,0xa4,0xce,0x2d,0xe1 | ||
2 | ,0x72,0x8e,0x3b,0xf4,0x80,0x35,0x0f,0x25 | ||
3 | ,0xe0,0x7e,0x21,0xc9,0x47,0xd1,0x9e,0x33 | ||
4 | ,0x76,0xf0,0x9b,0x3c,0x1e,0x16,0x17,0x42 | ||
diff --git a/nacl/tests/scalarmult7.cpp b/nacl/tests/scalarmult7.cpp deleted file mode 100644 index 8382d747..00000000 --- a/nacl/tests/scalarmult7.cpp +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | #include <string> | ||
2 | using std::string; | ||
3 | #include <stdio.h> | ||
4 | #include "crypto_scalarmult_curve25519.h" | ||
5 | |||
6 | char alicesk_bytes[32] = { | ||
7 | 0x77,0x07,0x6d,0x0a,0x73,0x18,0xa5,0x7d | ||
8 | ,0x3c,0x16,0xc1,0x72,0x51,0xb2,0x66,0x45 | ||
9 | ,0xdf,0x4c,0x2f,0x87,0xeb,0xc0,0x99,0x2a | ||
10 | ,0xb1,0x77,0xfb,0xa5,0x1d,0xb9,0x2c,0x2a | ||
11 | } ; | ||
12 | |||
13 | char bobpk_bytes[32] = { | ||
14 | 0xde,0x9e,0xdb,0x7d,0x7b,0x7d,0xc1,0xb4 | ||
15 | ,0xd3,0x5b,0x61,0xc2,0xec,0xe4,0x35,0x37 | ||
16 | ,0x3f,0x83,0x43,0xc8,0x5b,0x78,0x67,0x4d | ||
17 | ,0xad,0xfc,0x7e,0x14,0x6f,0x88,0x2b,0x4f | ||
18 | } ; | ||
19 | |||
20 | main() | ||
21 | { | ||
22 | int i; | ||
23 | string alicesk(alicesk_bytes,sizeof alicesk_bytes); | ||
24 | string bobpk(bobpk_bytes,sizeof bobpk_bytes); | ||
25 | string k = crypto_scalarmult_curve25519(alicesk,bobpk); | ||
26 | for (i = 0;i < k.size();++i) { | ||
27 | if (i > 0) printf(","); else printf(" "); | ||
28 | printf("0x%02x",(unsigned int) (unsigned char) k[i]); | ||
29 | if (i % 8 == 7) printf("\n"); | ||
30 | } | ||
31 | return 0; | ||
32 | } | ||
diff --git a/nacl/tests/scalarmult7.out b/nacl/tests/scalarmult7.out deleted file mode 100644 index bec21130..00000000 --- a/nacl/tests/scalarmult7.out +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | 0x4a,0x5d,0x9d,0x5b,0xa4,0xce,0x2d,0xe1 | ||
2 | ,0x72,0x8e,0x3b,0xf4,0x80,0x35,0x0f,0x25 | ||
3 | ,0xe0,0x7e,0x21,0xc9,0x47,0xd1,0x9e,0x33 | ||
4 | ,0x76,0xf0,0x9b,0x3c,0x1e,0x16,0x17,0x42 | ||
diff --git a/nacl/tests/secretbox.c b/nacl/tests/secretbox.c deleted file mode 100644 index 773f5b62..00000000 --- a/nacl/tests/secretbox.c +++ /dev/null | |||
@@ -1,56 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | #include "crypto_secretbox_xsalsa20poly1305.h" | ||
3 | |||
4 | unsigned char firstkey[32] = { | ||
5 | 0x1b,0x27,0x55,0x64,0x73,0xe9,0x85,0xd4 | ||
6 | ,0x62,0xcd,0x51,0x19,0x7a,0x9a,0x46,0xc7 | ||
7 | ,0x60,0x09,0x54,0x9e,0xac,0x64,0x74,0xf2 | ||
8 | ,0x06,0xc4,0xee,0x08,0x44,0xf6,0x83,0x89 | ||
9 | } ; | ||
10 | |||
11 | unsigned char nonce[24] = { | ||
12 | 0x69,0x69,0x6e,0xe9,0x55,0xb6,0x2b,0x73 | ||
13 | ,0xcd,0x62,0xbd,0xa8,0x75,0xfc,0x73,0xd6 | ||
14 | ,0x82,0x19,0xe0,0x03,0x6b,0x7a,0x0b,0x37 | ||
15 | } ; | ||
16 | |||
17 | // API requires first 32 bytes to be 0 | ||
18 | unsigned char m[163] = { | ||
19 | 0, 0, 0, 0, 0, 0, 0, 0 | ||
20 | , 0, 0, 0, 0, 0, 0, 0, 0 | ||
21 | , 0, 0, 0, 0, 0, 0, 0, 0 | ||
22 | , 0, 0, 0, 0, 0, 0, 0, 0 | ||
23 | ,0xbe,0x07,0x5f,0xc5,0x3c,0x81,0xf2,0xd5 | ||
24 | ,0xcf,0x14,0x13,0x16,0xeb,0xeb,0x0c,0x7b | ||
25 | ,0x52,0x28,0xc5,0x2a,0x4c,0x62,0xcb,0xd4 | ||
26 | ,0x4b,0x66,0x84,0x9b,0x64,0x24,0x4f,0xfc | ||
27 | ,0xe5,0xec,0xba,0xaf,0x33,0xbd,0x75,0x1a | ||
28 | ,0x1a,0xc7,0x28,0xd4,0x5e,0x6c,0x61,0x29 | ||
29 | ,0x6c,0xdc,0x3c,0x01,0x23,0x35,0x61,0xf4 | ||
30 | ,0x1d,0xb6,0x6c,0xce,0x31,0x4a,0xdb,0x31 | ||
31 | ,0x0e,0x3b,0xe8,0x25,0x0c,0x46,0xf0,0x6d | ||
32 | ,0xce,0xea,0x3a,0x7f,0xa1,0x34,0x80,0x57 | ||
33 | ,0xe2,0xf6,0x55,0x6a,0xd6,0xb1,0x31,0x8a | ||
34 | ,0x02,0x4a,0x83,0x8f,0x21,0xaf,0x1f,0xde | ||
35 | ,0x04,0x89,0x77,0xeb,0x48,0xf5,0x9f,0xfd | ||
36 | ,0x49,0x24,0xca,0x1c,0x60,0x90,0x2e,0x52 | ||
37 | ,0xf0,0xa0,0x89,0xbc,0x76,0x89,0x70,0x40 | ||
38 | ,0xe0,0x82,0xf9,0x37,0x76,0x38,0x48,0x64 | ||
39 | ,0x5e,0x07,0x05 | ||
40 | } ; | ||
41 | |||
42 | unsigned char c[163]; | ||
43 | |||
44 | main() | ||
45 | { | ||
46 | int i; | ||
47 | crypto_secretbox_xsalsa20poly1305( | ||
48 | c,m,163,nonce,firstkey | ||
49 | ); | ||
50 | for (i = 16;i < 163;++i) { | ||
51 | printf(",0x%02x",(unsigned int) c[i]); | ||
52 | if (i % 8 == 7) printf("\n"); | ||
53 | } | ||
54 | printf("\n"); | ||
55 | return 0; | ||
56 | } | ||
diff --git a/nacl/tests/secretbox.out b/nacl/tests/secretbox.out deleted file mode 100644 index 2b6c51ea..00000000 --- a/nacl/tests/secretbox.out +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | ,0xf3,0xff,0xc7,0x70,0x3f,0x94,0x00,0xe5 | ||
2 | ,0x2a,0x7d,0xfb,0x4b,0x3d,0x33,0x05,0xd9 | ||
3 | ,0x8e,0x99,0x3b,0x9f,0x48,0x68,0x12,0x73 | ||
4 | ,0xc2,0x96,0x50,0xba,0x32,0xfc,0x76,0xce | ||
5 | ,0x48,0x33,0x2e,0xa7,0x16,0x4d,0x96,0xa4 | ||
6 | ,0x47,0x6f,0xb8,0xc5,0x31,0xa1,0x18,0x6a | ||
7 | ,0xc0,0xdf,0xc1,0x7c,0x98,0xdc,0xe8,0x7b | ||
8 | ,0x4d,0xa7,0xf0,0x11,0xec,0x48,0xc9,0x72 | ||
9 | ,0x71,0xd2,0xc2,0x0f,0x9b,0x92,0x8f,0xe2 | ||
10 | ,0x27,0x0d,0x6f,0xb8,0x63,0xd5,0x17,0x38 | ||
11 | ,0xb4,0x8e,0xee,0xe3,0x14,0xa7,0xcc,0x8a | ||
12 | ,0xb9,0x32,0x16,0x45,0x48,0xe5,0x26,0xae | ||
13 | ,0x90,0x22,0x43,0x68,0x51,0x7a,0xcf,0xea | ||
14 | ,0xbd,0x6b,0xb3,0x73,0x2b,0xc0,0xe9,0xda | ||
15 | ,0x99,0x83,0x2b,0x61,0xca,0x01,0xb6,0xde | ||
16 | ,0x56,0x24,0x4a,0x9e,0x88,0xd5,0xf9,0xb3 | ||
17 | ,0x79,0x73,0xf6,0x22,0xa4,0x3d,0x14,0xa6 | ||
18 | ,0x59,0x9b,0x1f,0x65,0x4c,0xb4,0x5a,0x74 | ||
19 | ,0xe3,0x55,0xa5 | ||
diff --git a/nacl/tests/secretbox2.c b/nacl/tests/secretbox2.c deleted file mode 100644 index b6a2a937..00000000 --- a/nacl/tests/secretbox2.c +++ /dev/null | |||
@@ -1,57 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | #include "crypto_secretbox_xsalsa20poly1305.h" | ||
3 | |||
4 | unsigned char firstkey[32] = { | ||
5 | 0x1b,0x27,0x55,0x64,0x73,0xe9,0x85,0xd4 | ||
6 | ,0x62,0xcd,0x51,0x19,0x7a,0x9a,0x46,0xc7 | ||
7 | ,0x60,0x09,0x54,0x9e,0xac,0x64,0x74,0xf2 | ||
8 | ,0x06,0xc4,0xee,0x08,0x44,0xf6,0x83,0x89 | ||
9 | } ; | ||
10 | |||
11 | unsigned char nonce[24] = { | ||
12 | 0x69,0x69,0x6e,0xe9,0x55,0xb6,0x2b,0x73 | ||
13 | ,0xcd,0x62,0xbd,0xa8,0x75,0xfc,0x73,0xd6 | ||
14 | ,0x82,0x19,0xe0,0x03,0x6b,0x7a,0x0b,0x37 | ||
15 | } ; | ||
16 | |||
17 | // API requires first 16 bytes to be 0 | ||
18 | unsigned char c[163] = { | ||
19 | 0, 0, 0, 0, 0, 0, 0, 0 | ||
20 | , 0, 0, 0, 0, 0, 0, 0, 0 | ||
21 | ,0xf3,0xff,0xc7,0x70,0x3f,0x94,0x00,0xe5 | ||
22 | ,0x2a,0x7d,0xfb,0x4b,0x3d,0x33,0x05,0xd9 | ||
23 | ,0x8e,0x99,0x3b,0x9f,0x48,0x68,0x12,0x73 | ||
24 | ,0xc2,0x96,0x50,0xba,0x32,0xfc,0x76,0xce | ||
25 | ,0x48,0x33,0x2e,0xa7,0x16,0x4d,0x96,0xa4 | ||
26 | ,0x47,0x6f,0xb8,0xc5,0x31,0xa1,0x18,0x6a | ||
27 | ,0xc0,0xdf,0xc1,0x7c,0x98,0xdc,0xe8,0x7b | ||
28 | ,0x4d,0xa7,0xf0,0x11,0xec,0x48,0xc9,0x72 | ||
29 | ,0x71,0xd2,0xc2,0x0f,0x9b,0x92,0x8f,0xe2 | ||
30 | ,0x27,0x0d,0x6f,0xb8,0x63,0xd5,0x17,0x38 | ||
31 | ,0xb4,0x8e,0xee,0xe3,0x14,0xa7,0xcc,0x8a | ||
32 | ,0xb9,0x32,0x16,0x45,0x48,0xe5,0x26,0xae | ||
33 | ,0x90,0x22,0x43,0x68,0x51,0x7a,0xcf,0xea | ||
34 | ,0xbd,0x6b,0xb3,0x73,0x2b,0xc0,0xe9,0xda | ||
35 | ,0x99,0x83,0x2b,0x61,0xca,0x01,0xb6,0xde | ||
36 | ,0x56,0x24,0x4a,0x9e,0x88,0xd5,0xf9,0xb3 | ||
37 | ,0x79,0x73,0xf6,0x22,0xa4,0x3d,0x14,0xa6 | ||
38 | ,0x59,0x9b,0x1f,0x65,0x4c,0xb4,0x5a,0x74 | ||
39 | ,0xe3,0x55,0xa5 | ||
40 | } ; | ||
41 | |||
42 | unsigned char m[163]; | ||
43 | |||
44 | main() | ||
45 | { | ||
46 | int i; | ||
47 | if (crypto_secretbox_xsalsa20poly1305_open( | ||
48 | m,c,163,nonce,firstkey | ||
49 | ) == 0) { | ||
50 | for (i = 32;i < 163;++i) { | ||
51 | printf(",0x%02x",(unsigned int) m[i]); | ||
52 | if (i % 8 == 7) printf("\n"); | ||
53 | } | ||
54 | printf("\n"); | ||
55 | } | ||
56 | return 0; | ||
57 | } | ||
diff --git a/nacl/tests/secretbox2.out b/nacl/tests/secretbox2.out deleted file mode 100644 index c61d4557..00000000 --- a/nacl/tests/secretbox2.out +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | ,0xbe,0x07,0x5f,0xc5,0x3c,0x81,0xf2,0xd5 | ||
2 | ,0xcf,0x14,0x13,0x16,0xeb,0xeb,0x0c,0x7b | ||
3 | ,0x52,0x28,0xc5,0x2a,0x4c,0x62,0xcb,0xd4 | ||
4 | ,0x4b,0x66,0x84,0x9b,0x64,0x24,0x4f,0xfc | ||
5 | ,0xe5,0xec,0xba,0xaf,0x33,0xbd,0x75,0x1a | ||
6 | ,0x1a,0xc7,0x28,0xd4,0x5e,0x6c,0x61,0x29 | ||
7 | ,0x6c,0xdc,0x3c,0x01,0x23,0x35,0x61,0xf4 | ||
8 | ,0x1d,0xb6,0x6c,0xce,0x31,0x4a,0xdb,0x31 | ||
9 | ,0x0e,0x3b,0xe8,0x25,0x0c,0x46,0xf0,0x6d | ||
10 | ,0xce,0xea,0x3a,0x7f,0xa1,0x34,0x80,0x57 | ||
11 | ,0xe2,0xf6,0x55,0x6a,0xd6,0xb1,0x31,0x8a | ||
12 | ,0x02,0x4a,0x83,0x8f,0x21,0xaf,0x1f,0xde | ||
13 | ,0x04,0x89,0x77,0xeb,0x48,0xf5,0x9f,0xfd | ||
14 | ,0x49,0x24,0xca,0x1c,0x60,0x90,0x2e,0x52 | ||
15 | ,0xf0,0xa0,0x89,0xbc,0x76,0x89,0x70,0x40 | ||
16 | ,0xe0,0x82,0xf9,0x37,0x76,0x38,0x48,0x64 | ||
17 | ,0x5e,0x07,0x05 | ||
diff --git a/nacl/tests/secretbox3.cpp b/nacl/tests/secretbox3.cpp deleted file mode 100644 index 39ca7c53..00000000 --- a/nacl/tests/secretbox3.cpp +++ /dev/null | |||
@@ -1,52 +0,0 @@ | |||
1 | #include <string> | ||
2 | using std::string; | ||
3 | #include <stdio.h> | ||
4 | #include "crypto_secretbox_xsalsa20poly1305.h" | ||
5 | |||
6 | char firstkey_bytes[32] = { | ||
7 | 0x1b,0x27,0x55,0x64,0x73,0xe9,0x85,0xd4 | ||
8 | ,0x62,0xcd,0x51,0x19,0x7a,0x9a,0x46,0xc7 | ||
9 | ,0x60,0x09,0x54,0x9e,0xac,0x64,0x74,0xf2 | ||
10 | ,0x06,0xc4,0xee,0x08,0x44,0xf6,0x83,0x89 | ||
11 | } ; | ||
12 | |||
13 | char nonce_bytes[24] = { | ||
14 | 0x69,0x69,0x6e,0xe9,0x55,0xb6,0x2b,0x73 | ||
15 | ,0xcd,0x62,0xbd,0xa8,0x75,0xfc,0x73,0xd6 | ||
16 | ,0x82,0x19,0xe0,0x03,0x6b,0x7a,0x0b,0x37 | ||
17 | } ; | ||
18 | |||
19 | char m_bytes[131] = { | ||
20 | 0xbe,0x07,0x5f,0xc5,0x3c,0x81,0xf2,0xd5 | ||
21 | ,0xcf,0x14,0x13,0x16,0xeb,0xeb,0x0c,0x7b | ||
22 | ,0x52,0x28,0xc5,0x2a,0x4c,0x62,0xcb,0xd4 | ||
23 | ,0x4b,0x66,0x84,0x9b,0x64,0x24,0x4f,0xfc | ||
24 | ,0xe5,0xec,0xba,0xaf,0x33,0xbd,0x75,0x1a | ||
25 | ,0x1a,0xc7,0x28,0xd4,0x5e,0x6c,0x61,0x29 | ||
26 | ,0x6c,0xdc,0x3c,0x01,0x23,0x35,0x61,0xf4 | ||
27 | ,0x1d,0xb6,0x6c,0xce,0x31,0x4a,0xdb,0x31 | ||
28 | ,0x0e,0x3b,0xe8,0x25,0x0c,0x46,0xf0,0x6d | ||
29 | ,0xce,0xea,0x3a,0x7f,0xa1,0x34,0x80,0x57 | ||
30 | ,0xe2,0xf6,0x55,0x6a,0xd6,0xb1,0x31,0x8a | ||
31 | ,0x02,0x4a,0x83,0x8f,0x21,0xaf,0x1f,0xde | ||
32 | ,0x04,0x89,0x77,0xeb,0x48,0xf5,0x9f,0xfd | ||
33 | ,0x49,0x24,0xca,0x1c,0x60,0x90,0x2e,0x52 | ||
34 | ,0xf0,0xa0,0x89,0xbc,0x76,0x89,0x70,0x40 | ||
35 | ,0xe0,0x82,0xf9,0x37,0x76,0x38,0x48,0x64 | ||
36 | ,0x5e,0x07,0x05 | ||
37 | } ; | ||
38 | |||
39 | main() | ||
40 | { | ||
41 | int i; | ||
42 | string m(m_bytes,sizeof m_bytes); | ||
43 | string nonce(nonce_bytes,sizeof nonce_bytes); | ||
44 | string firstkey(firstkey_bytes,sizeof firstkey_bytes); | ||
45 | string c = crypto_secretbox_xsalsa20poly1305(m,nonce,firstkey); | ||
46 | for (i = 0;i < c.size();++i) { | ||
47 | printf(",0x%02x",(unsigned int) (unsigned char) c[i]); | ||
48 | if (i % 8 == 7) printf("\n"); | ||
49 | } | ||
50 | printf("\n"); | ||
51 | return 0; | ||
52 | } | ||
diff --git a/nacl/tests/secretbox3.out b/nacl/tests/secretbox3.out deleted file mode 100644 index 2b6c51ea..00000000 --- a/nacl/tests/secretbox3.out +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | ,0xf3,0xff,0xc7,0x70,0x3f,0x94,0x00,0xe5 | ||
2 | ,0x2a,0x7d,0xfb,0x4b,0x3d,0x33,0x05,0xd9 | ||
3 | ,0x8e,0x99,0x3b,0x9f,0x48,0x68,0x12,0x73 | ||
4 | ,0xc2,0x96,0x50,0xba,0x32,0xfc,0x76,0xce | ||
5 | ,0x48,0x33,0x2e,0xa7,0x16,0x4d,0x96,0xa4 | ||
6 | ,0x47,0x6f,0xb8,0xc5,0x31,0xa1,0x18,0x6a | ||
7 | ,0xc0,0xdf,0xc1,0x7c,0x98,0xdc,0xe8,0x7b | ||
8 | ,0x4d,0xa7,0xf0,0x11,0xec,0x48,0xc9,0x72 | ||
9 | ,0x71,0xd2,0xc2,0x0f,0x9b,0x92,0x8f,0xe2 | ||
10 | ,0x27,0x0d,0x6f,0xb8,0x63,0xd5,0x17,0x38 | ||
11 | ,0xb4,0x8e,0xee,0xe3,0x14,0xa7,0xcc,0x8a | ||
12 | ,0xb9,0x32,0x16,0x45,0x48,0xe5,0x26,0xae | ||
13 | ,0x90,0x22,0x43,0x68,0x51,0x7a,0xcf,0xea | ||
14 | ,0xbd,0x6b,0xb3,0x73,0x2b,0xc0,0xe9,0xda | ||
15 | ,0x99,0x83,0x2b,0x61,0xca,0x01,0xb6,0xde | ||
16 | ,0x56,0x24,0x4a,0x9e,0x88,0xd5,0xf9,0xb3 | ||
17 | ,0x79,0x73,0xf6,0x22,0xa4,0x3d,0x14,0xa6 | ||
18 | ,0x59,0x9b,0x1f,0x65,0x4c,0xb4,0x5a,0x74 | ||
19 | ,0xe3,0x55,0xa5 | ||
diff --git a/nacl/tests/secretbox4.cpp b/nacl/tests/secretbox4.cpp deleted file mode 100644 index 416e4d9e..00000000 --- a/nacl/tests/secretbox4.cpp +++ /dev/null | |||
@@ -1,54 +0,0 @@ | |||
1 | #include <string> | ||
2 | using std::string; | ||
3 | #include <stdio.h> | ||
4 | #include "crypto_secretbox_xsalsa20poly1305.h" | ||
5 | |||
6 | char firstkey_bytes[32] = { | ||
7 | 0x1b,0x27,0x55,0x64,0x73,0xe9,0x85,0xd4 | ||
8 | ,0x62,0xcd,0x51,0x19,0x7a,0x9a,0x46,0xc7 | ||
9 | ,0x60,0x09,0x54,0x9e,0xac,0x64,0x74,0xf2 | ||
10 | ,0x06,0xc4,0xee,0x08,0x44,0xf6,0x83,0x89 | ||
11 | } ; | ||
12 | |||
13 | char nonce_bytes[24] = { | ||
14 | 0x69,0x69,0x6e,0xe9,0x55,0xb6,0x2b,0x73 | ||
15 | ,0xcd,0x62,0xbd,0xa8,0x75,0xfc,0x73,0xd6 | ||
16 | ,0x82,0x19,0xe0,0x03,0x6b,0x7a,0x0b,0x37 | ||
17 | } ; | ||
18 | |||
19 | char c_bytes[147] = { | ||
20 | 0xf3,0xff,0xc7,0x70,0x3f,0x94,0x00,0xe5 | ||
21 | ,0x2a,0x7d,0xfb,0x4b,0x3d,0x33,0x05,0xd9 | ||
22 | ,0x8e,0x99,0x3b,0x9f,0x48,0x68,0x12,0x73 | ||
23 | ,0xc2,0x96,0x50,0xba,0x32,0xfc,0x76,0xce | ||
24 | ,0x48,0x33,0x2e,0xa7,0x16,0x4d,0x96,0xa4 | ||
25 | ,0x47,0x6f,0xb8,0xc5,0x31,0xa1,0x18,0x6a | ||
26 | ,0xc0,0xdf,0xc1,0x7c,0x98,0xdc,0xe8,0x7b | ||
27 | ,0x4d,0xa7,0xf0,0x11,0xec,0x48,0xc9,0x72 | ||
28 | ,0x71,0xd2,0xc2,0x0f,0x9b,0x92,0x8f,0xe2 | ||
29 | ,0x27,0x0d,0x6f,0xb8,0x63,0xd5,0x17,0x38 | ||
30 | ,0xb4,0x8e,0xee,0xe3,0x14,0xa7,0xcc,0x8a | ||
31 | ,0xb9,0x32,0x16,0x45,0x48,0xe5,0x26,0xae | ||
32 | ,0x90,0x22,0x43,0x68,0x51,0x7a,0xcf,0xea | ||
33 | ,0xbd,0x6b,0xb3,0x73,0x2b,0xc0,0xe9,0xda | ||
34 | ,0x99,0x83,0x2b,0x61,0xca,0x01,0xb6,0xde | ||
35 | ,0x56,0x24,0x4a,0x9e,0x88,0xd5,0xf9,0xb3 | ||
36 | ,0x79,0x73,0xf6,0x22,0xa4,0x3d,0x14,0xa6 | ||
37 | ,0x59,0x9b,0x1f,0x65,0x4c,0xb4,0x5a,0x74 | ||
38 | ,0xe3,0x55,0xa5 | ||
39 | } ; | ||
40 | |||
41 | main() | ||
42 | { | ||
43 | int i; | ||
44 | string firstkey(firstkey_bytes,sizeof firstkey_bytes); | ||
45 | string nonce(nonce_bytes,sizeof nonce_bytes); | ||
46 | string c(c_bytes,sizeof c_bytes); | ||
47 | string m = crypto_secretbox_xsalsa20poly1305_open(c,nonce,firstkey); | ||
48 | for (i = 0;i < m.size();++i) { | ||
49 | printf(",0x%02x",(unsigned int) (unsigned char) m[i]); | ||
50 | if (i % 8 == 7) printf("\n"); | ||
51 | } | ||
52 | printf("\n"); | ||
53 | return 0; | ||
54 | } | ||
diff --git a/nacl/tests/secretbox4.out b/nacl/tests/secretbox4.out deleted file mode 100644 index c61d4557..00000000 --- a/nacl/tests/secretbox4.out +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | ,0xbe,0x07,0x5f,0xc5,0x3c,0x81,0xf2,0xd5 | ||
2 | ,0xcf,0x14,0x13,0x16,0xeb,0xeb,0x0c,0x7b | ||
3 | ,0x52,0x28,0xc5,0x2a,0x4c,0x62,0xcb,0xd4 | ||
4 | ,0x4b,0x66,0x84,0x9b,0x64,0x24,0x4f,0xfc | ||
5 | ,0xe5,0xec,0xba,0xaf,0x33,0xbd,0x75,0x1a | ||
6 | ,0x1a,0xc7,0x28,0xd4,0x5e,0x6c,0x61,0x29 | ||
7 | ,0x6c,0xdc,0x3c,0x01,0x23,0x35,0x61,0xf4 | ||
8 | ,0x1d,0xb6,0x6c,0xce,0x31,0x4a,0xdb,0x31 | ||
9 | ,0x0e,0x3b,0xe8,0x25,0x0c,0x46,0xf0,0x6d | ||
10 | ,0xce,0xea,0x3a,0x7f,0xa1,0x34,0x80,0x57 | ||
11 | ,0xe2,0xf6,0x55,0x6a,0xd6,0xb1,0x31,0x8a | ||
12 | ,0x02,0x4a,0x83,0x8f,0x21,0xaf,0x1f,0xde | ||
13 | ,0x04,0x89,0x77,0xeb,0x48,0xf5,0x9f,0xfd | ||
14 | ,0x49,0x24,0xca,0x1c,0x60,0x90,0x2e,0x52 | ||
15 | ,0xf0,0xa0,0x89,0xbc,0x76,0x89,0x70,0x40 | ||
16 | ,0xe0,0x82,0xf9,0x37,0x76,0x38,0x48,0x64 | ||
17 | ,0x5e,0x07,0x05 | ||
diff --git a/nacl/tests/secretbox5.cpp b/nacl/tests/secretbox5.cpp deleted file mode 100644 index e8cc0eeb..00000000 --- a/nacl/tests/secretbox5.cpp +++ /dev/null | |||
@@ -1,29 +0,0 @@ | |||
1 | #include <string> | ||
2 | using std::string; | ||
3 | #include <stdio.h> | ||
4 | #include "crypto_secretbox.h" | ||
5 | #include "randombytes.h" | ||
6 | |||
7 | main() | ||
8 | { | ||
9 | int mlen; | ||
10 | for (mlen = 0;mlen < 1000;++mlen) { | ||
11 | unsigned char kbytes[crypto_secretbox_KEYBYTES]; | ||
12 | randombytes(kbytes,crypto_secretbox_KEYBYTES); | ||
13 | string k((char *) kbytes,crypto_secretbox_KEYBYTES); | ||
14 | unsigned char nbytes[crypto_secretbox_NONCEBYTES]; | ||
15 | randombytes(nbytes,crypto_secretbox_NONCEBYTES); | ||
16 | string n((char *) nbytes,crypto_secretbox_NONCEBYTES); | ||
17 | unsigned char mbytes[mlen]; | ||
18 | randombytes(mbytes,mlen); | ||
19 | string m((char *) mbytes,mlen); | ||
20 | string c = crypto_secretbox(m,n,k); | ||
21 | try { | ||
22 | string m2 = crypto_secretbox_open(c,n,k); | ||
23 | if (m != m2) printf("bad decryption\n"); | ||
24 | } catch(const char *s) { | ||
25 | printf("%s\n",s); | ||
26 | } | ||
27 | } | ||
28 | return 0; | ||
29 | } | ||
diff --git a/nacl/tests/secretbox5.out b/nacl/tests/secretbox5.out deleted file mode 100644 index e69de29b..00000000 --- a/nacl/tests/secretbox5.out +++ /dev/null | |||
diff --git a/nacl/tests/secretbox6.cpp b/nacl/tests/secretbox6.cpp deleted file mode 100644 index e8274006..00000000 --- a/nacl/tests/secretbox6.cpp +++ /dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | #include <string> | ||
2 | using std::string; | ||
3 | #include <stdlib.h> | ||
4 | #include <stdio.h> | ||
5 | #include "crypto_secretbox.h" | ||
6 | #include "randombytes.h" | ||
7 | |||
8 | main() | ||
9 | { | ||
10 | int mlen; | ||
11 | for (mlen = 0;mlen < 1000;++mlen) { | ||
12 | unsigned char kbytes[crypto_secretbox_KEYBYTES]; | ||
13 | randombytes(kbytes,crypto_secretbox_KEYBYTES); | ||
14 | string k((char *) kbytes,crypto_secretbox_KEYBYTES); | ||
15 | unsigned char nbytes[crypto_secretbox_NONCEBYTES]; | ||
16 | randombytes(nbytes,crypto_secretbox_NONCEBYTES); | ||
17 | string n((char *) nbytes,crypto_secretbox_NONCEBYTES); | ||
18 | unsigned char mbytes[mlen]; | ||
19 | randombytes(mbytes,mlen); | ||
20 | string m((char *) mbytes,mlen); | ||
21 | string c = crypto_secretbox(m,n,k); | ||
22 | int caught = 0; | ||
23 | while (caught < 10) { | ||
24 | c.replace(random() % c.size(),1,1,random()); | ||
25 | try { | ||
26 | string m2 = crypto_secretbox_open(c,n,k); | ||
27 | if (m != m2) { | ||
28 | printf("forgery\n"); | ||
29 | return 100; | ||
30 | } | ||
31 | } catch(const char *s) { | ||
32 | if (string(s) == string("ciphertext fails verification")) | ||
33 | ++caught; | ||
34 | else { | ||
35 | printf("%s\n",s); | ||
36 | return 111; | ||
37 | } | ||
38 | } | ||
39 | } | ||
40 | } | ||
41 | return 0; | ||
42 | } | ||
diff --git a/nacl/tests/secretbox6.out b/nacl/tests/secretbox6.out deleted file mode 100644 index e69de29b..00000000 --- a/nacl/tests/secretbox6.out +++ /dev/null | |||
diff --git a/nacl/tests/secretbox7.c b/nacl/tests/secretbox7.c deleted file mode 100644 index d4be9b49..00000000 --- a/nacl/tests/secretbox7.c +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | #include "crypto_secretbox.h" | ||
3 | #include "randombytes.h" | ||
4 | |||
5 | unsigned char k[crypto_secretbox_KEYBYTES]; | ||
6 | unsigned char n[crypto_secretbox_NONCEBYTES]; | ||
7 | unsigned char m[10000]; | ||
8 | unsigned char c[10000]; | ||
9 | unsigned char m2[10000]; | ||
10 | |||
11 | main() | ||
12 | { | ||
13 | int mlen; | ||
14 | int i; | ||
15 | |||
16 | for (mlen = 0;mlen < 1000 && mlen + crypto_secretbox_ZEROBYTES < sizeof m;++mlen) { | ||
17 | randombytes(k,crypto_secretbox_KEYBYTES); | ||
18 | randombytes(n,crypto_secretbox_NONCEBYTES); | ||
19 | randombytes(m + crypto_secretbox_ZEROBYTES,mlen); | ||
20 | crypto_secretbox(c,m,mlen + crypto_secretbox_ZEROBYTES,n,k); | ||
21 | if (crypto_secretbox_open(m2,c,mlen + crypto_secretbox_ZEROBYTES,n,k) == 0) { | ||
22 | for (i = 0;i < mlen + crypto_secretbox_ZEROBYTES;++i) | ||
23 | if (m2[i] != m[i]) { | ||
24 | printf("bad decryption\n"); | ||
25 | break; | ||
26 | } | ||
27 | } else { | ||
28 | printf("ciphertext fails verification\n"); | ||
29 | } | ||
30 | } | ||
31 | return 0; | ||
32 | } | ||
diff --git a/nacl/tests/secretbox7.out b/nacl/tests/secretbox7.out deleted file mode 100644 index e69de29b..00000000 --- a/nacl/tests/secretbox7.out +++ /dev/null | |||
diff --git a/nacl/tests/secretbox8.c b/nacl/tests/secretbox8.c deleted file mode 100644 index a6c75c23..00000000 --- a/nacl/tests/secretbox8.c +++ /dev/null | |||
@@ -1,37 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | #include "crypto_secretbox.h" | ||
3 | #include "randombytes.h" | ||
4 | |||
5 | unsigned char k[crypto_secretbox_KEYBYTES]; | ||
6 | unsigned char n[crypto_secretbox_NONCEBYTES]; | ||
7 | unsigned char m[10000]; | ||
8 | unsigned char c[10000]; | ||
9 | unsigned char m2[10000]; | ||
10 | |||
11 | main() | ||
12 | { | ||
13 | int mlen; | ||
14 | int i; | ||
15 | int caught; | ||
16 | |||
17 | for (mlen = 0;mlen < 1000 && mlen + crypto_secretbox_ZEROBYTES < sizeof m;++mlen) { | ||
18 | randombytes(k,crypto_secretbox_KEYBYTES); | ||
19 | randombytes(n,crypto_secretbox_NONCEBYTES); | ||
20 | randombytes(m + crypto_secretbox_ZEROBYTES,mlen); | ||
21 | crypto_secretbox(c,m,mlen + crypto_secretbox_ZEROBYTES,n,k); | ||
22 | caught = 0; | ||
23 | while (caught < 10) { | ||
24 | c[random() % (mlen + crypto_secretbox_ZEROBYTES)] = random(); | ||
25 | if (crypto_secretbox_open(m2,c,mlen + crypto_secretbox_ZEROBYTES,n,k) == 0) { | ||
26 | for (i = 0;i < mlen + crypto_secretbox_ZEROBYTES;++i) | ||
27 | if (m2[i] != m[i]) { | ||
28 | printf("forgery\n"); | ||
29 | return 100; | ||
30 | } | ||
31 | } else { | ||
32 | ++caught; | ||
33 | } | ||
34 | } | ||
35 | } | ||
36 | return 0; | ||
37 | } | ||
diff --git a/nacl/tests/secretbox8.out b/nacl/tests/secretbox8.out deleted file mode 100644 index e69de29b..00000000 --- a/nacl/tests/secretbox8.out +++ /dev/null | |||
diff --git a/nacl/tests/stream.c b/nacl/tests/stream.c deleted file mode 100644 index ebb39398..00000000 --- a/nacl/tests/stream.c +++ /dev/null | |||
@@ -1,29 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | #include "crypto_stream_xsalsa20.h" | ||
3 | #include "crypto_hash_sha256.h" | ||
4 | |||
5 | unsigned char firstkey[32] = { | ||
6 | 0x1b,0x27,0x55,0x64,0x73,0xe9,0x85,0xd4 | ||
7 | ,0x62,0xcd,0x51,0x19,0x7a,0x9a,0x46,0xc7 | ||
8 | ,0x60,0x09,0x54,0x9e,0xac,0x64,0x74,0xf2 | ||
9 | ,0x06,0xc4,0xee,0x08,0x44,0xf6,0x83,0x89 | ||
10 | } ; | ||
11 | |||
12 | unsigned char nonce[24] = { | ||
13 | 0x69,0x69,0x6e,0xe9,0x55,0xb6,0x2b,0x73 | ||
14 | ,0xcd,0x62,0xbd,0xa8,0x75,0xfc,0x73,0xd6 | ||
15 | ,0x82,0x19,0xe0,0x03,0x6b,0x7a,0x0b,0x37 | ||
16 | } ; | ||
17 | |||
18 | unsigned char output[4194304]; | ||
19 | |||
20 | unsigned char h[32]; | ||
21 | |||
22 | main() | ||
23 | { | ||
24 | int i; | ||
25 | crypto_stream_xsalsa20(output,4194304,nonce,firstkey); | ||
26 | crypto_hash_sha256(h,output,sizeof output); | ||
27 | for (i = 0;i < 32;++i) printf("%02x",h[i]); printf("\n"); | ||
28 | return 0; | ||
29 | } | ||
diff --git a/nacl/tests/stream.out b/nacl/tests/stream.out deleted file mode 100644 index 5fa208c1..00000000 --- a/nacl/tests/stream.out +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | 662b9d0e3463029156069b12f918691a98f7dfb2ca0393c96bbfc6b1fbd630a2 | ||
diff --git a/nacl/tests/stream2.c b/nacl/tests/stream2.c deleted file mode 100644 index 12f13de4..00000000 --- a/nacl/tests/stream2.c +++ /dev/null | |||
@@ -1,27 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | #include "crypto_stream_salsa20.h" | ||
3 | #include "crypto_hash_sha256.h" | ||
4 | |||
5 | unsigned char secondkey[32] = { | ||
6 | 0xdc,0x90,0x8d,0xda,0x0b,0x93,0x44,0xa9 | ||
7 | ,0x53,0x62,0x9b,0x73,0x38,0x20,0x77,0x88 | ||
8 | ,0x80,0xf3,0xce,0xb4,0x21,0xbb,0x61,0xb9 | ||
9 | ,0x1c,0xbd,0x4c,0x3e,0x66,0x25,0x6c,0xe4 | ||
10 | } ; | ||
11 | |||
12 | unsigned char noncesuffix[8] = { | ||
13 | 0x82,0x19,0xe0,0x03,0x6b,0x7a,0x0b,0x37 | ||
14 | } ; | ||
15 | |||
16 | unsigned char output[4194304]; | ||
17 | |||
18 | unsigned char h[32]; | ||
19 | |||
20 | main() | ||
21 | { | ||
22 | int i; | ||
23 | crypto_stream_salsa20(output,4194304,noncesuffix,secondkey); | ||
24 | crypto_hash_sha256(h,output,sizeof output); | ||
25 | for (i = 0;i < 32;++i) printf("%02x",h[i]); printf("\n"); | ||
26 | return 0; | ||
27 | } | ||
diff --git a/nacl/tests/stream2.out b/nacl/tests/stream2.out deleted file mode 100644 index 5fa208c1..00000000 --- a/nacl/tests/stream2.out +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | 662b9d0e3463029156069b12f918691a98f7dfb2ca0393c96bbfc6b1fbd630a2 | ||
diff --git a/nacl/tests/stream3.c b/nacl/tests/stream3.c deleted file mode 100644 index 7798dc18..00000000 --- a/nacl/tests/stream3.c +++ /dev/null | |||
@@ -1,28 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | #include "crypto_stream_xsalsa20.h" | ||
3 | |||
4 | unsigned char firstkey[32] = { | ||
5 | 0x1b,0x27,0x55,0x64,0x73,0xe9,0x85,0xd4 | ||
6 | ,0x62,0xcd,0x51,0x19,0x7a,0x9a,0x46,0xc7 | ||
7 | ,0x60,0x09,0x54,0x9e,0xac,0x64,0x74,0xf2 | ||
8 | ,0x06,0xc4,0xee,0x08,0x44,0xf6,0x83,0x89 | ||
9 | } ; | ||
10 | |||
11 | unsigned char nonce[24] = { | ||
12 | 0x69,0x69,0x6e,0xe9,0x55,0xb6,0x2b,0x73 | ||
13 | ,0xcd,0x62,0xbd,0xa8,0x75,0xfc,0x73,0xd6 | ||
14 | ,0x82,0x19,0xe0,0x03,0x6b,0x7a,0x0b,0x37 | ||
15 | } ; | ||
16 | |||
17 | unsigned char rs[32]; | ||
18 | |||
19 | main() | ||
20 | { | ||
21 | int i; | ||
22 | crypto_stream_xsalsa20(rs,32,nonce,firstkey); | ||
23 | for (i = 0;i < 32;++i) { | ||
24 | printf(",0x%02x",(unsigned int) rs[i]); | ||
25 | if (i % 8 == 7) printf("\n"); | ||
26 | } | ||
27 | return 0; | ||
28 | } | ||
diff --git a/nacl/tests/stream3.out b/nacl/tests/stream3.out deleted file mode 100644 index 9cd78798..00000000 --- a/nacl/tests/stream3.out +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | ,0xee,0xa6,0xa7,0x25,0x1c,0x1e,0x72,0x91 | ||
2 | ,0x6d,0x11,0xc2,0xcb,0x21,0x4d,0x3c,0x25 | ||
3 | ,0x25,0x39,0x12,0x1d,0x8e,0x23,0x4e,0x65 | ||
4 | ,0x2d,0x65,0x1f,0xa4,0xc8,0xcf,0xf8,0x80 | ||
diff --git a/nacl/tests/stream4.c b/nacl/tests/stream4.c deleted file mode 100644 index 84d8c523..00000000 --- a/nacl/tests/stream4.c +++ /dev/null | |||
@@ -1,53 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | #include "crypto_stream_xsalsa20.h" | ||
3 | |||
4 | unsigned char firstkey[32] = { | ||
5 | 0x1b,0x27,0x55,0x64,0x73,0xe9,0x85,0xd4 | ||
6 | ,0x62,0xcd,0x51,0x19,0x7a,0x9a,0x46,0xc7 | ||
7 | ,0x60,0x09,0x54,0x9e,0xac,0x64,0x74,0xf2 | ||
8 | ,0x06,0xc4,0xee,0x08,0x44,0xf6,0x83,0x89 | ||
9 | } ; | ||
10 | |||
11 | unsigned char nonce[24] = { | ||
12 | 0x69,0x69,0x6e,0xe9,0x55,0xb6,0x2b,0x73 | ||
13 | ,0xcd,0x62,0xbd,0xa8,0x75,0xfc,0x73,0xd6 | ||
14 | ,0x82,0x19,0xe0,0x03,0x6b,0x7a,0x0b,0x37 | ||
15 | } ; | ||
16 | |||
17 | unsigned char m[163] = { | ||
18 | 0, 0, 0, 0, 0, 0, 0, 0 | ||
19 | , 0, 0, 0, 0, 0, 0, 0, 0 | ||
20 | , 0, 0, 0, 0, 0, 0, 0, 0 | ||
21 | , 0, 0, 0, 0, 0, 0, 0, 0 | ||
22 | ,0xbe,0x07,0x5f,0xc5,0x3c,0x81,0xf2,0xd5 | ||
23 | ,0xcf,0x14,0x13,0x16,0xeb,0xeb,0x0c,0x7b | ||
24 | ,0x52,0x28,0xc5,0x2a,0x4c,0x62,0xcb,0xd4 | ||
25 | ,0x4b,0x66,0x84,0x9b,0x64,0x24,0x4f,0xfc | ||
26 | ,0xe5,0xec,0xba,0xaf,0x33,0xbd,0x75,0x1a | ||
27 | ,0x1a,0xc7,0x28,0xd4,0x5e,0x6c,0x61,0x29 | ||
28 | ,0x6c,0xdc,0x3c,0x01,0x23,0x35,0x61,0xf4 | ||
29 | ,0x1d,0xb6,0x6c,0xce,0x31,0x4a,0xdb,0x31 | ||
30 | ,0x0e,0x3b,0xe8,0x25,0x0c,0x46,0xf0,0x6d | ||
31 | ,0xce,0xea,0x3a,0x7f,0xa1,0x34,0x80,0x57 | ||
32 | ,0xe2,0xf6,0x55,0x6a,0xd6,0xb1,0x31,0x8a | ||
33 | ,0x02,0x4a,0x83,0x8f,0x21,0xaf,0x1f,0xde | ||
34 | ,0x04,0x89,0x77,0xeb,0x48,0xf5,0x9f,0xfd | ||
35 | ,0x49,0x24,0xca,0x1c,0x60,0x90,0x2e,0x52 | ||
36 | ,0xf0,0xa0,0x89,0xbc,0x76,0x89,0x70,0x40 | ||
37 | ,0xe0,0x82,0xf9,0x37,0x76,0x38,0x48,0x64 | ||
38 | ,0x5e,0x07,0x05 | ||
39 | } ; | ||
40 | |||
41 | unsigned char c[163]; | ||
42 | |||
43 | main() | ||
44 | { | ||
45 | int i; | ||
46 | crypto_stream_xsalsa20_xor(c,m,163,nonce,firstkey); | ||
47 | for (i = 32;i < 163;++i) { | ||
48 | printf(",0x%02x",(unsigned int) c[i]); | ||
49 | if (i % 8 == 7) printf("\n"); | ||
50 | } | ||
51 | printf("\n"); | ||
52 | return 0; | ||
53 | } | ||
diff --git a/nacl/tests/stream4.out b/nacl/tests/stream4.out deleted file mode 100644 index 0d3d8e94..00000000 --- a/nacl/tests/stream4.out +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | ,0x8e,0x99,0x3b,0x9f,0x48,0x68,0x12,0x73 | ||
2 | ,0xc2,0x96,0x50,0xba,0x32,0xfc,0x76,0xce | ||
3 | ,0x48,0x33,0x2e,0xa7,0x16,0x4d,0x96,0xa4 | ||
4 | ,0x47,0x6f,0xb8,0xc5,0x31,0xa1,0x18,0x6a | ||
5 | ,0xc0,0xdf,0xc1,0x7c,0x98,0xdc,0xe8,0x7b | ||
6 | ,0x4d,0xa7,0xf0,0x11,0xec,0x48,0xc9,0x72 | ||
7 | ,0x71,0xd2,0xc2,0x0f,0x9b,0x92,0x8f,0xe2 | ||
8 | ,0x27,0x0d,0x6f,0xb8,0x63,0xd5,0x17,0x38 | ||
9 | ,0xb4,0x8e,0xee,0xe3,0x14,0xa7,0xcc,0x8a | ||
10 | ,0xb9,0x32,0x16,0x45,0x48,0xe5,0x26,0xae | ||
11 | ,0x90,0x22,0x43,0x68,0x51,0x7a,0xcf,0xea | ||
12 | ,0xbd,0x6b,0xb3,0x73,0x2b,0xc0,0xe9,0xda | ||
13 | ,0x99,0x83,0x2b,0x61,0xca,0x01,0xb6,0xde | ||
14 | ,0x56,0x24,0x4a,0x9e,0x88,0xd5,0xf9,0xb3 | ||
15 | ,0x79,0x73,0xf6,0x22,0xa4,0x3d,0x14,0xa6 | ||
16 | ,0x59,0x9b,0x1f,0x65,0x4c,0xb4,0x5a,0x74 | ||
17 | ,0xe3,0x55,0xa5 | ||
diff --git a/nacl/tests/stream5.cpp b/nacl/tests/stream5.cpp deleted file mode 100644 index 66f3839b..00000000 --- a/nacl/tests/stream5.cpp +++ /dev/null | |||
@@ -1,29 +0,0 @@ | |||
1 | #include <string> | ||
2 | using std::string; | ||
3 | #include <stdio.h> | ||
4 | #include "crypto_stream_xsalsa20.h" | ||
5 | #include "crypto_hash_sha256.h" | ||
6 | |||
7 | char firstkey_bytes[32] = { | ||
8 | 0x1b,0x27,0x55,0x64,0x73,0xe9,0x85,0xd4 | ||
9 | ,0x62,0xcd,0x51,0x19,0x7a,0x9a,0x46,0xc7 | ||
10 | ,0x60,0x09,0x54,0x9e,0xac,0x64,0x74,0xf2 | ||
11 | ,0x06,0xc4,0xee,0x08,0x44,0xf6,0x83,0x89 | ||
12 | } ; | ||
13 | |||
14 | char nonce_bytes[24] = { | ||
15 | 0x69,0x69,0x6e,0xe9,0x55,0xb6,0x2b,0x73 | ||
16 | ,0xcd,0x62,0xbd,0xa8,0x75,0xfc,0x73,0xd6 | ||
17 | ,0x82,0x19,0xe0,0x03,0x6b,0x7a,0x0b,0x37 | ||
18 | } ; | ||
19 | |||
20 | main() | ||
21 | { | ||
22 | int i; | ||
23 | string firstkey(firstkey_bytes,sizeof firstkey_bytes); | ||
24 | string nonce(nonce_bytes,sizeof nonce_bytes); | ||
25 | string output = crypto_stream_xsalsa20(4194304,nonce,firstkey); | ||
26 | string h = crypto_hash_sha256(output); | ||
27 | for (i = 0;i < 32;++i) printf("%02x",(unsigned int) (unsigned char) h[i]); printf("\n"); | ||
28 | return 0; | ||
29 | } | ||
diff --git a/nacl/tests/stream5.out b/nacl/tests/stream5.out deleted file mode 100644 index 5fa208c1..00000000 --- a/nacl/tests/stream5.out +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | 662b9d0e3463029156069b12f918691a98f7dfb2ca0393c96bbfc6b1fbd630a2 | ||
diff --git a/nacl/tests/stream6.cpp b/nacl/tests/stream6.cpp deleted file mode 100644 index d9ed61f7..00000000 --- a/nacl/tests/stream6.cpp +++ /dev/null | |||
@@ -1,27 +0,0 @@ | |||
1 | #include <string> | ||
2 | using std::string; | ||
3 | #include <stdio.h> | ||
4 | #include "crypto_stream_salsa20.h" | ||
5 | #include "crypto_hash_sha256.h" | ||
6 | |||
7 | char secondkey_bytes[32] = { | ||
8 | 0xdc,0x90,0x8d,0xda,0x0b,0x93,0x44,0xa9 | ||
9 | ,0x53,0x62,0x9b,0x73,0x38,0x20,0x77,0x88 | ||
10 | ,0x80,0xf3,0xce,0xb4,0x21,0xbb,0x61,0xb9 | ||
11 | ,0x1c,0xbd,0x4c,0x3e,0x66,0x25,0x6c,0xe4 | ||
12 | } ; | ||
13 | |||
14 | char noncesuffix_bytes[8] = { | ||
15 | 0x82,0x19,0xe0,0x03,0x6b,0x7a,0x0b,0x37 | ||
16 | } ; | ||
17 | |||
18 | main() | ||
19 | { | ||
20 | int i; | ||
21 | string secondkey(secondkey_bytes,sizeof secondkey_bytes); | ||
22 | string noncesuffix(noncesuffix_bytes,sizeof noncesuffix_bytes); | ||
23 | string output = crypto_stream_salsa20(4194304,noncesuffix,secondkey); | ||
24 | string h = crypto_hash_sha256(output); | ||
25 | for (i = 0;i < 32;++i) printf("%02x",(unsigned int) (unsigned char) h[i]); printf("\n"); | ||
26 | return 0; | ||
27 | } | ||
diff --git a/nacl/tests/stream6.out b/nacl/tests/stream6.out deleted file mode 100644 index 5fa208c1..00000000 --- a/nacl/tests/stream6.out +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | 662b9d0e3463029156069b12f918691a98f7dfb2ca0393c96bbfc6b1fbd630a2 | ||
diff --git a/nacl/tests/stream7.cpp b/nacl/tests/stream7.cpp deleted file mode 100644 index d2f106e5..00000000 --- a/nacl/tests/stream7.cpp +++ /dev/null | |||
@@ -1,30 +0,0 @@ | |||
1 | #include <string> | ||
2 | using std::string; | ||
3 | #include <stdio.h> | ||
4 | #include "crypto_stream_xsalsa20.h" | ||
5 | |||
6 | char firstkey_bytes[32] = { | ||
7 | 0x1b,0x27,0x55,0x64,0x73,0xe9,0x85,0xd4 | ||
8 | ,0x62,0xcd,0x51,0x19,0x7a,0x9a,0x46,0xc7 | ||
9 | ,0x60,0x09,0x54,0x9e,0xac,0x64,0x74,0xf2 | ||
10 | ,0x06,0xc4,0xee,0x08,0x44,0xf6,0x83,0x89 | ||
11 | } ; | ||
12 | |||
13 | char nonce_bytes[24] = { | ||
14 | 0x69,0x69,0x6e,0xe9,0x55,0xb6,0x2b,0x73 | ||
15 | ,0xcd,0x62,0xbd,0xa8,0x75,0xfc,0x73,0xd6 | ||
16 | ,0x82,0x19,0xe0,0x03,0x6b,0x7a,0x0b,0x37 | ||
17 | } ; | ||
18 | |||
19 | main() | ||
20 | { | ||
21 | int i; | ||
22 | string firstkey(firstkey_bytes,sizeof firstkey_bytes); | ||
23 | string nonce(nonce_bytes,sizeof nonce_bytes); | ||
24 | string rs = crypto_stream_xsalsa20(32,nonce,firstkey); | ||
25 | for (i = 0;i < rs.size();++i) { | ||
26 | printf(",0x%02x",(unsigned int) (unsigned char) rs[i]); | ||
27 | if (i % 8 == 7) printf("\n"); | ||
28 | } | ||
29 | return 0; | ||
30 | } | ||
diff --git a/nacl/tests/stream7.out b/nacl/tests/stream7.out deleted file mode 100644 index 9cd78798..00000000 --- a/nacl/tests/stream7.out +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | ,0xee,0xa6,0xa7,0x25,0x1c,0x1e,0x72,0x91 | ||
2 | ,0x6d,0x11,0xc2,0xcb,0x21,0x4d,0x3c,0x25 | ||
3 | ,0x25,0x39,0x12,0x1d,0x8e,0x23,0x4e,0x65 | ||
4 | ,0x2d,0x65,0x1f,0xa4,0xc8,0xcf,0xf8,0x80 | ||
diff --git a/nacl/tests/stream8.cpp b/nacl/tests/stream8.cpp deleted file mode 100644 index ea95d68f..00000000 --- a/nacl/tests/stream8.cpp +++ /dev/null | |||
@@ -1,56 +0,0 @@ | |||
1 | #include <string> | ||
2 | using std::string; | ||
3 | #include <stdio.h> | ||
4 | #include "crypto_stream_xsalsa20.h" | ||
5 | |||
6 | char firstkey_bytes[32] = { | ||
7 | 0x1b,0x27,0x55,0x64,0x73,0xe9,0x85,0xd4 | ||
8 | ,0x62,0xcd,0x51,0x19,0x7a,0x9a,0x46,0xc7 | ||
9 | ,0x60,0x09,0x54,0x9e,0xac,0x64,0x74,0xf2 | ||
10 | ,0x06,0xc4,0xee,0x08,0x44,0xf6,0x83,0x89 | ||
11 | } ; | ||
12 | |||
13 | char nonce_bytes[24] = { | ||
14 | 0x69,0x69,0x6e,0xe9,0x55,0xb6,0x2b,0x73 | ||
15 | ,0xcd,0x62,0xbd,0xa8,0x75,0xfc,0x73,0xd6 | ||
16 | ,0x82,0x19,0xe0,0x03,0x6b,0x7a,0x0b,0x37 | ||
17 | } ; | ||
18 | |||
19 | char m_bytes[163] = { | ||
20 | 0, 0, 0, 0, 0, 0, 0, 0 | ||
21 | , 0, 0, 0, 0, 0, 0, 0, 0 | ||
22 | , 0, 0, 0, 0, 0, 0, 0, 0 | ||
23 | , 0, 0, 0, 0, 0, 0, 0, 0 | ||
24 | ,0xbe,0x07,0x5f,0xc5,0x3c,0x81,0xf2,0xd5 | ||
25 | ,0xcf,0x14,0x13,0x16,0xeb,0xeb,0x0c,0x7b | ||
26 | ,0x52,0x28,0xc5,0x2a,0x4c,0x62,0xcb,0xd4 | ||
27 | ,0x4b,0x66,0x84,0x9b,0x64,0x24,0x4f,0xfc | ||
28 | ,0xe5,0xec,0xba,0xaf,0x33,0xbd,0x75,0x1a | ||
29 | ,0x1a,0xc7,0x28,0xd4,0x5e,0x6c,0x61,0x29 | ||
30 | ,0x6c,0xdc,0x3c,0x01,0x23,0x35,0x61,0xf4 | ||
31 | ,0x1d,0xb6,0x6c,0xce,0x31,0x4a,0xdb,0x31 | ||
32 | ,0x0e,0x3b,0xe8,0x25,0x0c,0x46,0xf0,0x6d | ||
33 | ,0xce,0xea,0x3a,0x7f,0xa1,0x34,0x80,0x57 | ||
34 | ,0xe2,0xf6,0x55,0x6a,0xd6,0xb1,0x31,0x8a | ||
35 | ,0x02,0x4a,0x83,0x8f,0x21,0xaf,0x1f,0xde | ||
36 | ,0x04,0x89,0x77,0xeb,0x48,0xf5,0x9f,0xfd | ||
37 | ,0x49,0x24,0xca,0x1c,0x60,0x90,0x2e,0x52 | ||
38 | ,0xf0,0xa0,0x89,0xbc,0x76,0x89,0x70,0x40 | ||
39 | ,0xe0,0x82,0xf9,0x37,0x76,0x38,0x48,0x64 | ||
40 | ,0x5e,0x07,0x05 | ||
41 | } ; | ||
42 | |||
43 | main() | ||
44 | { | ||
45 | int i; | ||
46 | string firstkey(firstkey_bytes,sizeof firstkey_bytes); | ||
47 | string nonce(nonce_bytes,sizeof nonce_bytes); | ||
48 | string m(m_bytes,sizeof m_bytes); | ||
49 | string c = crypto_stream_xsalsa20_xor(m,nonce,firstkey); | ||
50 | for (i = 32;i < c.size();++i) { | ||
51 | printf(",0x%02x",(unsigned int) (unsigned char) c[i]); | ||
52 | if (i % 8 == 7) printf("\n"); | ||
53 | } | ||
54 | printf("\n"); | ||
55 | return 0; | ||
56 | } | ||
diff --git a/nacl/tests/stream8.out b/nacl/tests/stream8.out deleted file mode 100644 index 0d3d8e94..00000000 --- a/nacl/tests/stream8.out +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | ,0x8e,0x99,0x3b,0x9f,0x48,0x68,0x12,0x73 | ||
2 | ,0xc2,0x96,0x50,0xba,0x32,0xfc,0x76,0xce | ||
3 | ,0x48,0x33,0x2e,0xa7,0x16,0x4d,0x96,0xa4 | ||
4 | ,0x47,0x6f,0xb8,0xc5,0x31,0xa1,0x18,0x6a | ||
5 | ,0xc0,0xdf,0xc1,0x7c,0x98,0xdc,0xe8,0x7b | ||
6 | ,0x4d,0xa7,0xf0,0x11,0xec,0x48,0xc9,0x72 | ||
7 | ,0x71,0xd2,0xc2,0x0f,0x9b,0x92,0x8f,0xe2 | ||
8 | ,0x27,0x0d,0x6f,0xb8,0x63,0xd5,0x17,0x38 | ||
9 | ,0xb4,0x8e,0xee,0xe3,0x14,0xa7,0xcc,0x8a | ||
10 | ,0xb9,0x32,0x16,0x45,0x48,0xe5,0x26,0xae | ||
11 | ,0x90,0x22,0x43,0x68,0x51,0x7a,0xcf,0xea | ||
12 | ,0xbd,0x6b,0xb3,0x73,0x2b,0xc0,0xe9,0xda | ||
13 | ,0x99,0x83,0x2b,0x61,0xca,0x01,0xb6,0xde | ||
14 | ,0x56,0x24,0x4a,0x9e,0x88,0xd5,0xf9,0xb3 | ||
15 | ,0x79,0x73,0xf6,0x22,0xa4,0x3d,0x14,0xa6 | ||
16 | ,0x59,0x9b,0x1f,0x65,0x4c,0xb4,0x5a,0x74 | ||
17 | ,0xe3,0x55,0xa5 | ||