Commit 5ada00b5 authored by Tim McNamara's avatar Tim McNamara


parent 8a10b2fe
## [FNV][] (Fowler–Noll–Vo)
The FNV hash function requires uses different primes and offset bases that are used depending on the desired length of the output hash function.
Implementing it in Rust is quite pleasant, although appears to be affected by overflow issues:
fn fnv_32(input: &[u8]) -> u32 {
let mut hash = 0x811c9dc5_u32;
let prime = 16777619_u32;
for byte in input {
hash *= prime;
hash ^= *byte as u32;
TODO: Add calculating the offset basis and primes.
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment