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