Home | History | Annotate | Line # | Download | only in default
      1  1.1  riastrad 
      2  1.1  riastrad #define TEST_NAME "siphashx24"
      3  1.1  riastrad #include "cmptest.h"
      4  1.1  riastrad 
      5  1.1  riastrad #define MAXLEN 64
      6  1.1  riastrad 
      7  1.1  riastrad int
      8  1.1  riastrad main(void)
      9  1.1  riastrad {
     10  1.1  riastrad     unsigned char in[MAXLEN];
     11  1.1  riastrad     unsigned char out[crypto_shorthash_siphashx24_BYTES];
     12  1.1  riastrad     unsigned char k[crypto_shorthash_siphashx24_KEYBYTES];
     13  1.1  riastrad     size_t        i;
     14  1.1  riastrad     size_t        j;
     15  1.1  riastrad 
     16  1.1  riastrad     for (i = 0; i < crypto_shorthash_siphashx24_KEYBYTES; ++i) {
     17  1.1  riastrad         k[i] = (unsigned char) i;
     18  1.1  riastrad     }
     19  1.1  riastrad     for (i = 0; i < MAXLEN; ++i) {
     20  1.1  riastrad         in[i] = (unsigned char) i;
     21  1.1  riastrad         crypto_shorthash_siphashx24(out, in, (unsigned long long) i, k);
     22  1.1  riastrad         for (j = 0; j < crypto_shorthash_siphashx24_BYTES; ++j) {
     23  1.1  riastrad             printf("%02x", (unsigned int) out[j]);
     24  1.1  riastrad         }
     25  1.1  riastrad         printf("\n");
     26  1.1  riastrad     }
     27  1.1  riastrad     assert(crypto_shorthash_siphashx24_KEYBYTES >= crypto_shorthash_siphash24_KEYBYTES);
     28  1.1  riastrad     assert(crypto_shorthash_siphashx24_BYTES > crypto_shorthash_siphash24_BYTES);
     29  1.1  riastrad     assert(crypto_shorthash_siphashx24_bytes() == crypto_shorthash_siphashx24_BYTES);
     30  1.1  riastrad     assert(crypto_shorthash_siphashx24_keybytes() == crypto_shorthash_siphashx24_KEYBYTES);
     31  1.1  riastrad 
     32  1.1  riastrad     return 0;
     33  1.1  riastrad }
     34