summaryrefslogtreecommitdiff
path: root/test/default/shorthash.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/default/shorthash.c')
-rw-r--r--test/default/shorthash.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/test/default/shorthash.c b/test/default/shorthash.c
index 6f1d7f3..18081cd 100644
--- a/test/default/shorthash.c
+++ b/test/default/shorthash.c
@@ -1,6 +1,3 @@
-#include <stdio.h>
-
-#include "crypto_uint8.h"
#define TEST_NAME "shorthash"
#include "cmptest.h"
@@ -8,16 +5,26 @@
int main(void)
{
#define MAXLEN 64
- crypto_uint8 in[MAXLEN], out[crypto_shorthash_BYTES], k[crypto_shorthash_KEYBYTES];
- size_t i,j;
+ unsigned char in[MAXLEN], out[crypto_shorthash_BYTES],
+ k[crypto_shorthash_KEYBYTES];
+ size_t i, j;
- for( i = 0; i < crypto_shorthash_KEYBYTES; ++i ) k[i] = i;
+ for (i = 0; i < crypto_shorthash_KEYBYTES; ++i)
+ k[i] = i;
- for(i=0;i<MAXLEN;++i) {
- in[i]=i;
- crypto_shorthash( out, in, i, k );
- for (j = 0;j < crypto_shorthash_BYTES;++j) printf("%02x",(unsigned int) out[j]);
+ for (i = 0; i < MAXLEN; ++i) {
+ in[i] = i;
+ crypto_shorthash(out, in, i, k);
+ for (j = 0; j < crypto_shorthash_BYTES; ++j)
+ printf("%02x", (unsigned int)out[j]);
printf("\n");
}
+ assert(crypto_shorthash_bytes() > 0);
+ assert(crypto_shorthash_keybytes() > 0);
+ assert(strcmp(crypto_shorthash_primitive(), "siphash24") == 0);
+ assert(crypto_shorthash_bytes() == crypto_shorthash_siphash24_bytes());
+ assert(crypto_shorthash_keybytes()
+ == crypto_shorthash_siphash24_keybytes());
+
return 0;
}