[][src]Crate sthash

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

Hasher

A Hasher can be reused to compute multiple hashes using the same key

Key

A large secret key, derived from a secret seed

Constants

MIN_SEED_BYTES

Minimum seed size, in bytes

OUTPUT_BYTES

Hash output size, in bytes

SEED_BYTES

Recommended seed size, in bytes