diff options
author | irungentoo <irungentoo@gmail.com> | 2013-07-02 09:53:34 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2013-07-02 09:53:34 -0400 |
commit | e2967396ac73cb7410787886cdaf072a184ffc49 (patch) | |
tree | 527a74d25a4a0705fc641994fd35bfab22662034 /nacl/tests/auth.c | |
parent | 8928c817df345f29aa0b194743595aa11bd6a8ba (diff) |
Added NaCl crypto library.
Diffstat (limited to 'nacl/tests/auth.c')
-rw-r--r-- | nacl/tests/auth.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/nacl/tests/auth.c b/nacl/tests/auth.c new file mode 100644 index 00000000..5086624e --- /dev/null +++ b/nacl/tests/auth.c | |||
@@ -0,0 +1,19 @@ | |||
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 | } | ||