siphashx24.c 1.0 KB

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