ic-storage 0.78.0

Named stable-memory allocations and governed upstream stable collections
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! Shared non-cryptographic FNV-1a hashing for checksums and diagnostics.

/// FNV-1a initial state.
pub const FNV_OFFSET: u64 = 0xcbf2_9ce4_8422_2325;

/// Extend a non-cryptographic checksum with bytes.
pub fn fnv64(mut hash: u64, bytes: &[u8]) -> u64 {
    for byte in bytes {
        hash = (hash ^ u64::from(*byte)).wrapping_mul(0x0000_0100_0000_01b3);
    }
    hash
}

#[cfg(test)]
mod tests;