pub const FNV0_32_INIT : u32 = 0;
pub const FNV1_32_INIT : u32 = 0x811c9dc5;
pub const FNV1A_32_INIT : u32 = FNV1_32_INIT;
pub const FNV0_64_INIT : u64 = 0;
pub const FNV1_64_INIT : u64 = 0xcbf29ce484222325;
pub const FNV1A_64_INIT : u64 = FNV1_64_INIT;
pub const FNV0_128_INIT : u128 = 0;
pub const FNV1_128_INIT: u128 = 0x6c62272e07bb014262b821756295c58d;
pub const FNV1A_128_INIT : u128 = FNV1_128_INIT;
pub const FNV_128_PRIME: u128 = 0x1000000000000000000013b;
pub const FNV_64_PRIME: u64 = 0x100000001b3;
pub const FNV_32_PRIME: u32 = 0x01000193;
proc_strarray::str_array!(FNV_BASIS, r#"chongo <Landon Curt Noll> /\../\"#, 32);
pub fn fnv_32(buf: &[u8], hval: u32) -> u32
{
let mut hash = hval;
for byte in buf {
hash = hash.wrapping_mul(FNV_32_PRIME);
hash ^= *byte as u32;
}
hash
}
pub fn fnv_32a(buf: &[u8], hval: u32) -> u32
{
let mut hash = hval;
for byte in buf {
hash ^= *byte as u32;
hash = hash.wrapping_mul(FNV_32_PRIME);
}
hash
}
pub fn fnv_64(buf: &[u8], hval: u64) -> u64
{
let mut hash = hval;
for byte in buf {
hash = hash.wrapping_mul(FNV_64_PRIME);
hash ^= *byte as u64;
}
hash
}
pub fn fnv_64a(buf: &[u8], hval: u64) -> u64
{
let mut hash = hval;
for byte in buf {
hash ^= *byte as u64;
hash = hash.wrapping_mul(FNV_64_PRIME);
}
hash
}
pub fn fnv_128(buf: &[u8], hval: u128) -> u128
{
let mut hash = hval;
for byte in buf {
hash = hash.wrapping_mul(FNV_128_PRIME);
hash ^= *byte as u128;
}
hash
}
pub fn fnv_128a(buf: &[u8], hval: u128) -> u128
{
let mut hash = hval;
for byte in buf {
hash ^= *byte as u128;
hash = hash.wrapping_mul(FNV_128_PRIME);
}
hash
}
#[cfg(test)]
#[path = "offset_basis_tests.rs"]
mod offset_bassis_tests;
#[cfg(test)]
#[path = "testsuite.rs"]
mod fnv_test;