Debian Codegraph @

examples/stadtx/stadtx.go

raw symbols SCIP
1 // Code generated by downloading from https://github.com/dgryski/go-stadtx/raw/3c3d9b328c24a9b5ecd370654cd6e9d60a85752d/stadtx.go. DO NOT EDIT.
2
3 // Package stadtx implements Stadtx Hash
4 /*
5
6 https://github.com/demerphq/BeagleHash
7
8 */
9 package stadtx
10
11 func rotl64(x uint64, r uint64) uint64 {
12 return (((x) << (r)) | ((x) >> (64 - r)))
13 }
14
15 func rotr64(x uint64, r uint64) uint64 {
16 return (((x) >> (r)) | ((x) << (64 - r)))
17 }
18
19 func scramble64(v, prime uint64) uint64 {
20 v ^= (v >> 13)
21 v ^= (v << 35)
22 v ^= (v >> 30)
23 v *= prime
24 v ^= (v >> 19)
25 v ^= (v << 15)
26 v ^= (v >> 46)
27 return v
28 }
29
30 func SeedState(seed []uint64) State {
31
32 var state State
33
34 state[0] = seed[0] ^ 0x43f6a8885a308d31
35 state[1] = seed[1] ^ 0x3198a2e03707344a
36 state[2] = seed[0] ^ 0x4093822299f31d00
37 state[3] = seed[1] ^ 0x82efa98ec4e6c894
38
39 if state[0] == 0 {
40 state[0] = 1
41 }
42 if state[1] == 0 {
43 state[1] = 2
44 }
45 if state[2] == 0 {
46 state[2] = 4
47 }
48 if state[3] == 0 {
49 state[3] = 8
50 }
51
52 state[0] = scramble64(state[0], 0x801178846e899d17)
53 state[0] = scramble64(state[0], 0xdd51e5d1c9a5a151)
54 state[1] = scramble64(state[1], 0x93a7d6c8c62e4835)
55 state[1] = scramble64(state[1], 0x803340f36895c2b5)
56 state[2] = scramble64(state[2], 0xbea9344eb7565eeb)
57 state[2] = scramble64(state[2], 0xcd95d1e509b995cd)
58 state[3] = scramble64(state[3], 0x9999791977e30c13)
59 state[3] = scramble64(state[3], 0xaab8b6b05abfc6cd)
60
61 return state
62 }
63
64 type State [4]uint64