2013-04-19 15:28:19 -07:00
|
|
|
|
|
|
|
#define TEST_NAME "generichash"
|
|
|
|
#include "cmptest.h"
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
|
|
|
#define MAXLEN 64
|
2014-09-13 14:15:55 -07:00
|
|
|
unsigned char in[MAXLEN], out[crypto_generichash_BYTES_MAX], k[crypto_generichash_KEYBYTES_MAX];
|
2013-04-26 23:25:14 -07:00
|
|
|
size_t h,i,j;
|
2013-04-19 15:28:19 -07:00
|
|
|
|
|
|
|
for(h = 0; h < crypto_generichash_KEYBYTES_MAX; ++h) k[h] = h;
|
|
|
|
|
|
|
|
for(i = 0; i < MAXLEN; ++i) {
|
|
|
|
in[i]=i;
|
2013-04-21 05:46:21 -07:00
|
|
|
crypto_generichash(out, 1 + i % crypto_generichash_BYTES_MAX,
|
|
|
|
in, i,
|
|
|
|
k, 1 + i % crypto_generichash_KEYBYTES_MAX);
|
2013-04-19 15:28:19 -07:00
|
|
|
for (j = 0;j < 1 + i % crypto_generichash_BYTES_MAX;++j) {
|
|
|
|
printf("%02x",(unsigned int) out[j]);
|
|
|
|
}
|
|
|
|
printf("\n");
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|