libsodium: Needed for Dnscrypto-proxy Release 1.3.0
[tomato.git] / release / src / router / libsodium / test / default / generichash.c
blob42a4a39471abd98ca078e8ec80aa0b68fc684048
1 #include <stdio.h>
3 #include "crypto_uint8.h"
5 #define TEST_NAME "generichash"
6 #include "cmptest.h"
8 int main(void)
10 #define MAXLEN 64
11 crypto_uint8 in[MAXLEN], out[crypto_generichash_BYTES_MAX], k[crypto_generichash_KEYBYTES_MAX];
12 size_t h,i,j;
14 for(h = 0; h < crypto_generichash_KEYBYTES_MAX; ++h) k[h] = h;
16 for(i = 0; i < MAXLEN; ++i) {
17 in[i]=i;
18 crypto_generichash(out, 1 + i % crypto_generichash_BYTES_MAX,
19 in, i,
20 k, 1 + i % crypto_generichash_KEYBYTES_MAX);
21 for (j = 0;j < 1 + i % crypto_generichash_BYTES_MAX;++j) {
22 printf("%02x",(unsigned int) out[j]);
24 printf("\n");
26 return 0;