File: test_siphash.c

package info (click to toggle)
libstb 0.0~git20241109.5c20573%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 7,520 kB
  • sloc: ansic: 80,776; cpp: 1,506; makefile: 114; sh: 22
file content (21 lines) | stat: -rw-r--r-- 463 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdio.h>

#define STB_DS_IMPLEMENTATION
#define STBDS_SIPHASH_2_4
#define STBDS_TEST_SIPHASH_2_4
#include "../stb_ds.h"

int main(int argc, char **argv)
{
  unsigned char mem[64];
  int i,j;
  for (i=0; i < 64; ++i) mem[i] = i;
  for (i=0; i < 64; ++i) {
    size_t hash = stbds_hash_bytes(mem, i, 0);
    printf("  { ");
    for (j=0; j < 8; ++j)
      printf("0x%02x, ", (unsigned char) ((hash >> (j*8)) & 255));
    printf(" },\n");
  }
  return 0;
}