Skip to main content

hash

Function hash 

Source
pub fn hash(ty: HashType, key: &[u8]) -> DynToken
Expand description

Hash key with the requested algorithm and return the resulting token.

The returned token has len == 1 for every 32-bit algorithm and len == 4 for Murmur3. The contract is identical to the C hash_func_t it replaces: dispatch is total over HashType::all.

ยงExamples

use dynomite::hashkit::{hash, HashType};

let t1 = hash(HashType::Crc32a, b"abc");
let t2 = hash(HashType::Crc32a, b"abc");
assert_eq!(t1, t2);