Crate sthash[−][src]
Expand description
STHash - A fast cryptopgraphic hash function for large inputs.
Note: this is not a replacement for a generic hash function, as a secret seed is mandatory to protect against forgeries.
use rand::{thread_rng, RngCore};
use sthash::*;
let mut seed = [0; SEED_BYTES];
thread_rng().fill_bytes(&mut seed);
let key = Key::from_seed(&seed, Some(b"Application name"));
let hasher = Hasher::new(key, None);
let h1 = hasher.hash(b"test data 1");
let h2 = hasher.hash(b"test data 2");
Structs
A Hasher
can be reused to compute multiple hashes using the same key
A large secret key, derived from a secret seed
Constants
Minimum seed size, in bytes
Hash output size, in bytes
Recommended seed size, in bytes