11Hashes an atom with the 32-bit FNV non-cryptographic hash algorithm. Multiplies
12`a` by the prime number 16,777,619 and then takes the [block](../2c.md) of size
135 off the product's end, producing an atom.
25 ++ fnv |=(a=@ (end 5 1 (mul 16.777.619 a)))
45Hashes `a` with the 31-bit nonzero FNV-1a non-cryptographic hash algorithm,
62 =+ b=[p=$(a -.a) q=$(a +.a)]
64 =+ c=(fnv (mix p.b (fnv q.b)))
65 =+ d=(mix (rsh 0 31 c) (end 0 31 c))
74 =+ f=(mix (rsh 0 31 c) (end 0 31 c))
77 $(c (fnv (mix c (cut 3 [d 1] a))), d +(d))
104Implementation of the 32-bit
105[MurmurHash3](https://en.wikipedia.org/wiki/MurmurHash#Algorithm)
106non-cryptographic hash algorithm. Takes `a` as the seed, `b` as the key length
107in [blocks](../2c) of size 3, and `c` as the key, producing an atom.
125 |= [syd=@ len=@ key=@]
126 ?> &((lte (met 5 syd) 1) (lte (met 0 len) 31))
127 =/ pad (sub len (met 3 key))
128 =/ data (weld (rip 3 key) (reap pad 0))
129 =/ nblocks (div len 4) :: intentionally off-by-one
131 =+ [c1=0xcc9e.2d51 c2=0x1b87.3593]
132 =/ blocks (rip 5 key)
135 ?: =(0 i) hi :: negative array index
136 =/ k1 (snag (sub nblocks i) blocks)
137 =. k1 (sit (mul k1 c1))
139 =. k1 (sit (mul k1 c2))
142 =. hi (sum (sit (mul hi 5)) 0xe654.6b64)
144 =/ tail (slag (mul 4 nblocks) data)
148 ?+ tlen h1 :: fallthrough switch
149 $3 =. k1 (mix k1 (lsh 0 16 (snag 2 tail)))
150 =. k1 (mix k1 (lsh 0 8 (snag 1 tail)))
151 =. k1 (mix k1 (snag 0 tail))
152 =. k1 (sit (mul k1 c1))
154 =. k1 (sit (mul k1 c2))
156 $2 =. k1 (mix k1 (lsh 0 8 (snag 1 tail)))
157 =. k1 (mix k1 (snag 0 tail))
158 =. k1 (sit (mul k1 c1))
160 =. k1 (sit (mul k1 c2))
162 $1 =. k1 (mix k1 (snag 0 tail))
163 =. k1 (sit (mul k1 c1))
165 =. k1 (sit (mul k1 c2))
172 =. h (mix h (rsh 0 16 h))
173 =. h (sit (mul h 0x85eb.ca6b))
174 =. h (mix h (rsh 0 13 h))
175 =. h (sit (mul h 0xc2b2.ae35))
176 =. h (mix h (rsh 0 16 h))
204 > =e (cut 3 [0 2] eny) :: `eny` is 512 bits of entropy (a random number).
21631-bit MurmurHash3 scrambler
218Hashes `a` with the 31-bit MurmurHash3 non-cryptographic hash algorithm,
234 |^ (trim ?@(a a (mix $(a -.a) (mix 0x7fff.ffff $(a +.a)))))
239 =+ haz=(muk syd (met 3 key) key)
240 =+ ham=(mix (rsh 0 31 haz) (end 0 31 haz))
241 ?.(=(0 ham) ham $(syd +(syd)))
260 > (mum [1 2 3 4 5 ~])
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list