cwist
Modern C web framework with libttak runtime
Loading...
Searching...
No Matches
siphash.c File Reference

SipHash implementation plus CWIST-specific entropy expansion for hash seeds. More...

#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <cwist/sys/platform.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <cwist/core/siphash/siphash.h>
Include dependency graph for siphash.c:

Go to the source code of this file.

Macros

#define ROTL(x, b)   (uint64_t)(((x) << (b)) | ((x) >> (64 - (b))))
 

Functions

uint64_t siphash24 (const void *src, size_t len, const uint8_t key[16])
 Compute SipHash-2-4 over a byte range using a 16-byte secret key.
 
void cwist_generate_hash_seed (uint8_t key[16])
 Generate a non-trivial 16-byte key suitable for SipHash table seeding.
 

Detailed Description

SipHash implementation plus CWIST-specific entropy expansion for hash seeds.

Definition in file siphash.c.

Macro Definition Documentation

◆ ROTL

#define ROTL (   x,
  b 
)    (uint64_t)(((x) << (b)) | ((x) >> (64 - (b))))

Definition at line 21 of file siphash.c.

Function Documentation

◆ cwist_generate_hash_seed()

void cwist_generate_hash_seed ( uint8_t  key[16])

Generate a non-trivial 16-byte key suitable for SipHash table seeding.

Generates a random SipHash seed.

Parameters
keyOutput buffer that receives the generated seed.

Definition at line 223 of file siphash.c.

References cap.

Referenced by cwist_query_map_create_in_arena().

◆ siphash24()

uint64_t siphash24 ( const void *  src,
size_t  len,
const uint8_t  key[16] 
)

Compute SipHash-2-4 over a byte range using a 16-byte secret key.

Parameters
srcInput bytes to hash.
lenNumber of bytes in src.
key16-byte SipHash key.
Returns
64-bit keyed hash value.

Definition at line 52 of file siphash.c.

References cap.

Referenced by cwist_flash_get(), cwist_query_map_delete(), cwist_query_map_get(), and cwist_query_map_set().