test_siphash.c 463 B

123456789101112131415161718192021
  1. #include <stdio.h>
  2. #define STB_DS_IMPLEMENTATION
  3. #define STBDS_SIPHASH_2_4
  4. #define STBDS_TEST_SIPHASH_2_4
  5. #include "../stb_ds.h"
  6. int main(int argc, char **argv)
  7. {
  8. unsigned char mem[64];
  9. int i,j;
  10. for (i=0; i < 64; ++i) mem[i] = i;
  11. for (i=0; i < 64; ++i) {
  12. size_t hash = stbds_hash_bytes(mem, i, 0);
  13. printf(" { ");
  14. for (j=0; j < 8; ++j)
  15. printf("0x%02x, ", (unsigned char) ((hash >> (j*8)) & 255));
  16. printf(" },\n");
  17. }
  18. return 0;
  19. }