core/hash
hash
Procedures
24adler32
adler32 :: proc(data: []u8, seed: u32 = u32(1)) -> (u32)Sourcecrc16_ccitt_0x1021
crc16_ccitt_0x1021 :: proc(data: []u8, seed: u16 = u16(0)) -> (result: u16)SourceCompute CRC-16 in the manner of CCITT (ITU-T V.41), using the 0x1021 polynomial.
Generator polynomial: x^16 + x^12 + x^5 + 1
Used in the UDF (DVD *.iso) disk format's Volume Descriptor Tag,
and was more historically the ITU-T V.41 CRC-16 used in the XModem protocol,
which uses 0xffff as the initial value.crc32
crc32 :: proc(data: []u8, seed: u32 = u32(0)) -> (u32)Sourcecrc64_ecma_182
crc64_ecma_182 :: proc(data: []u8, seed: u64 = u64(0)) -> (result: u64)Sourcecrc64_iso_3306
crc64_iso_3306 :: proc(data: []u8, seed: u64 = u64(0)) -> (u64)SourceGenerator polynomial: x^64 + x^4 + x^3 + x + 1
crc64_iso_3306_inverse
crc64_iso_3306_inverse :: proc(data: []u8, seed: u64 = u64(0)) -> (u64)Sourcecrc64_xz
crc64_xz :: proc(data: []u8, seed: u64 = u64(0)) -> (u64)SourceCompute CRC-64 in the manner of xz, using the ECMA-182 polynomial,
bit-reversed, with one's complement pre and post processing.
Based on Mark Adler's v1.4 implementation in C under the ZLIB license.djb2
djb2 :: proc(data: []u8, seed: u32 = u32(5381)) -> (u32)Sourcedjbx33a
djbx33a :: proc(data: []u8, seed: u32 = u32(5381)) -> (result: [16]u8)Sourcefnv32
fnv32 :: proc(data: []u8, seed: u32 = u32(0x811c9dc5)) -> (u32)SourceNOTE(bill): Not a fan of these aliases but seems necessary
fnv32_no_a
fnv32_no_a :: proc(data: []u8, seed: u32 = u32(0x811c9dc5)) -> (u32)SourceIf you have a choice, prefer fnv32a
fnv32a
fnv32a :: proc(data: []u8, seed: u32 = u32(0x811c9dc5)) -> (u32)Sourcefnv64
fnv64 :: proc(data: []u8, seed: u64 = u64(0xcbf29ce484222325)) -> (u64)SourceNOTE(bill): Not a fan of these aliases but seems necessary
fnv64_no_a
fnv64_no_a :: proc(data: []u8, seed: u64 = u64(0xcbf29ce484222325)) -> (u64)SourceIf you have a choice, prefer fnv64a
fnv64a
fnv64a :: proc(data: []u8, seed: u64 = u64(0xcbf29ce484222325)) -> (u64)Sourceginger16
ginger16 :: proc(data: []u8) -> (u16)Sourceginger8
ginger8 :: proc(data: []u8) -> (u8)Sourceginger_hash16
ginger_hash16 :: proc(x: u16) -> (u16)Sourceginger_hash8
ginger_hash8 :: proc(x: u8) -> (u8)Sourcejenkins
jenkins :: proc(data: []u8, seed: u32 = u32(0)) -> (u32)Sourcemurmur32
murmur32 :: proc(data: []u8, seed: u32 = u32(0x9747b28c)) -> (u32)Sourcemurmur64a
murmur64a :: proc(data: []u8, seed: u64 = u64(0x9747b28c)) -> (u64)SourceSee https://github.com/aappleby/smhasher/blob/master/src/MurmurHash2.cpp#L96
murmur64b
murmur64b :: proc(data: []u8, seed: u64 = u64(0x9747b28c)) -> (u64)SourceSee https://github.com/aappleby/smhasher/blob/master/src/MurmurHash2.cpp#L140
sdbm
sdbm :: proc(data: []u8, seed: u32 = u32(0)) -> (u32)Source