-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathBeagleHashes_test.c
97 lines (81 loc) · 3.18 KB
/
BeagleHashes_test.c
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#ifdef __cplusplus
extern "C" {
#endif
#include <stdlib.h>
#include <stdio.h>
#include "BeagleHashes_test.h"
#include "beagle_hash.h"
#include "stadtx_hash.h"
#include "phat_hash.h"
#include "sbox32_hash.h"
#include "zaphod32_hash.h"
#include "zaphod64_hash.h"
void beagle_hash_with_state_32_128_a_smhasher(const void *key, STRLEN len, const void *state, void *out) {
*((U32 *)out)= beagle_hash_with_state_32_128_a((U8*)state, (U8 *)key, len);
}
void beagle_hash_with_state_64_128_a_smhasher(const void *key, STRLEN len, const void *state, void *out) {
*((U64 *)out)= beagle_hash_with_state_64_128_a((U8*)state, (U8 *)key, len);
}
void beagle_seed_state_128_a_smhasher( const int in_bits, const void *seed_base, void *state ) {
switch( in_bits ) {
case 64:
beagle_seed_state_64_128_a((U8*)seed_base,(U8*)state);
break;
case 96:
beagle_seed_state_96_128_a((U8*)seed_base,(U8*)state);
break;
case 112:
beagle_seed_state_112_128_a((U8*)seed_base,(U8*)state);
break;
case 127:
beagle_seed_state_127_128_a((U8*)seed_base,(U8*)state);
break;
case 128:
beagle_seed_state_128_128_a((U8*)seed_base,(U8*)state);
break;
default:
printf("Don't know how to prepare %d bits in beagle_seed_state_smhasher()",
in_bits);
exit(0);
}
}
void stadtx_seed_state_smhasher_test(int in_bits, const void *seed, void *state) {
stadtx_seed_state((U8*)seed,(U8*)state);
}
void stadtx_hash_with_state_smhasher_test(const void *key, STRLEN len, const void *state, void *out) {
*((U64 *)out)= stadtx_hash_with_state((U8*)state, (U8 *)key, len);
}
void zaphod32_seed_state_smhasher_test(int in_bits, const void *seed, void *state) {
zaphod32_seed_state((U8*)seed,(U8*)state);
}
void zaphod32_hash_with_state_smhasher_test(const void *key, STRLEN len, const void *seed, void *out) {
*((U32 *)out)= zaphod32_hash_with_state((U8*)seed, (U8 *)key, len);
}
void zaphod64_seed_state_smhasher_test(int in_bits, const void *seed, void *state) {
zaphod64_seed_state((U8*)seed,(U8*)state);
}
void zaphod64_hash_with_state_smhasher_test(const void *key, STRLEN len, const void *state, void *out) {
*((U64 *)out)= zaphod64_hash_with_state((U8*)state, (U8 *)key, len);
}
void sbox32_seed_state_smhasher(int in_bits, const void *seed, void *state) {
if ( in_bits == 96 ) {
sbox32_seed_state96((U8*)seed,(U8*)state);
} else if ( in_bits == 128 ) {
sbox32_seed_state128((U8*)seed,(U8*)state);
} else {
printf("Cant handle %d bit seeds in sbox32_seed_state_smhasher", in_bits);
exit(1);
}
}
void sbox32_hash_with_state_smhasher(const void *key, STRLEN len, const void *state, void *out) {
*((U32 *)out)= sbox32_hash_with_state((U8*)state, (U8 *)key, len);
}
void phat_seed_state_smhasher_test(int in_bits, const void *seed, void *state) {
phat_seed_state((U8*)seed,(U8*)state);
}
void phat_hash_with_state_smhasher_test(const void *key, STRLEN len, const void *seed, void *out) {
*((U32 *)out)= phat_hash_with_state((U8*)seed, (U8 *)key, len);
}
#ifdef __cplusplus
}
#endif