Tor 0.4.9.2-alpha-dev
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
siphash_rng.h
1/* Copyright (c) 2020 tevador <tevador@gmail.com> */
2/* See LICENSE for licensing information */
3
4#ifndef SIPHASH_GENERATOR_H
5#define SIPHASH_GENERATOR_H
6
7#include <stdint.h>
8#include <hashx.h>
9#include "siphash.h"
10
11typedef struct siphash_rng {
12 siphash_state keys;
13 uint64_t counter;
14 uint64_t buffer8, buffer32;
15 unsigned count8, count32;
16#ifdef HASHX_RNG_CALLBACK
17 void (*callback)(uint64_t *buffer, void *user_data);
18 void *callback_user_data;
19#endif
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26HASHX_PRIVATE void hashx_siphash_rng_init(siphash_rng* gen, const siphash_state* state);
27HASHX_PRIVATE uint32_t hashx_siphash_rng_u32(siphash_rng* gen);
28HASHX_PRIVATE uint8_t hashx_siphash_rng_u8(siphash_rng* gen);
29
30#ifdef __cplusplus
31}
32#endif
33
34#endif