forked from lmcilroy/mrx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
clm_hash2.h
48 lines (41 loc) · 1.06 KB
/
clm_hash2.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifdef __cplusplus
extern "C" {
#endif
#include <x86intrin.h>
struct clm_hash2_state {
union {
__m128i ints[8];
uint8_t chars[128];
} buf;
uint32_t count;
uint32_t block_size;
uint64_t total_len;
__m128i x1;
__m128i x2;
__m128i x3;
__m128i x4;
__m128i x5;
__m128i x6;
__m128i x7;
__m128i x8;
};
struct clm_hash2 {
__m128i h[8];
};
typedef struct clm_hash2_state clm_hash2_state_t;
typedef struct clm_hash2 clm_hash2_t;
/* Streaming interfaces */
void clm_hash2_start(clm_hash2_state_t * const state);
void clm_hash2_start_seed(clm_hash2_state_t * const state,
const void * const seed);
void clm_hash2_update(clm_hash2_state_t * const state,
const void * const data, const size_t len);
void clm_hash2_end(clm_hash2_state_t * const state, clm_hash2_t * const hash);
/* Convenience routines for single shot hashing */
void clm_hash2_seed(const void * const data, const size_t len,
const void * const seed, clm_hash2_t * const hash);
void clm_hash2(const void * const data, const size_t len,
clm_hash2_t * const hash);
#ifdef __cplusplus
}
#endif