//! FNV-1a 64, the hash behind asset IDs and name hashes; see docs/features/build.md#asset-ids.
const OFFSET: u64 = 0xcbf2_9ce4_8422_2325;
const PRIME: u64 = 0x0000_0100_0000_01b3;
pub fn fnv1a64(bytes: &[u8]) -> u64 {
bytes
.iter()
.fold(OFFSET, |h, &b| (h ^ u64::from(b)).wrapping_mul(PRIME))
}
#[cfg(test)]
mod tests {
#[test]
fn known_values() {
assert_eq!(super::fnv1a64(b""), 0xcbf2_9ce4_8422_2325);
assert_eq!(super::fnv1a64(b"a"), 0xaf63_dc4c_8601_ec8c);
}
}