Handbook
Glossary
city-murmur ( bytes low high -- hash )
Vocabulary
checksums
.
cityhash
.
private
Inputs
bytes
an
object
low
an
object
high
an
object
Outputs
hash
an
object
Definition
USING:
kernel
math
math.bitwise
sequences
;
IN:
checksums.cityhash.private
::
city-murmur
( bytes low high -- hash )
bytes
length
:>
len low
:>
a! high
:>
b! 0
:>
c! 0
:>
d! len
16
<=
[
a
k1
W*
shift-mix
k1
W*
a! b
k1
W*
bytes
hash64-0to16
W+
c! a len 8
>=
[
bytes 0
fetch64
]
[
c
]
if
W+
shift-mix
d!
]
[
bytes len 8
-
fetch64
k1
W+
a
hash16
c! b len
W+
c bytes len 16
-
fetch64
W+
hash16
d! a d
W+
a! len 1
-
16
/i
<iota>
[|
i |
a bytes i 16
*
fetch64
k1
W*
shift-mix
k1
W*
bitxor
k1
W*
a! b a
bitxor
b! c bytes i 16
*
8
+
fetch64
k1
W*
shift-mix
k1
W*
bitxor
k1
W*
c! d c
bitxor
d!
]
each
]
if
a c
hash16
a! d b
hash16
b! a b
bitxor
b a
hash16
>uint128
;