hash.fnv1a #
This module implements a FNV-1a hash. (see https://en.wikipedia.org/wiki/Fowler–Noll–Vo_hash_function)
fn new_fnv1a64 #
fn new_fnv1a64() &Fnv1a64
new_fnv1a64 creates an Fnv1a64 in its initial (offset-basis) state.
fn sum32 #
fn sum32(data []u8) u32
sum32 returns a fnv1a hash of the memory block, described by the dynamic byte array data.
fn sum32_bytes #
fn sum32_bytes(data &u8, data_len int) u32
sum32_bytes returns a fnv1a hash of data_len bytes starting at the address in the given &u8 pointer data.
fn sum32_string #
fn sum32_string(data string) u32
sum32 returns a fnv1a hash of the string, described by data
fn sum32_struct #
fn sum32_struct[T](s &T) u32
sum32_bytes returns a fnv1a hash of the struct s.
fn sum64 #
fn sum64(data []u8) u64
sum64 returns a fnv1a hash of the memory block, described by the dynamic byte array data.
fn sum64_bytes #
fn sum64_bytes(data &u8, data_len int) u64
sum64_bytes returns a fnv1a hash of data_len bytes starting at the address in the given &u8 pointer data.
fn sum64_string #
fn sum64_string(data string) u64
sum64 returns a fnv1a hash of the string, described by data
fn sum64_struct #
fn sum64_struct[T](s &T) u64
sum64_bytes returns a fnv1a hash of the struct s.
struct Fnv1a64 #
struct Fnv1a64 {
mut:
state u64
}
Fnv1a64 is a streaming FNV-1a 64-bit hasher. It implements hash.Hasher: bytes are absorbed with write and the digest is read any number of times with finish.
fn (Fnv1a64) write #
fn (mut h Fnv1a64) write(p []u8) !
write absorbs bytes into the hash state.
fn (Fnv1a64) finish #
fn (h &Fnv1a64) finish() u64
finish returns the current 64-bit digest without consuming state.
fn (Fnv1a64) sum #
fn (h &Fnv1a64) sum(data []u8) u64
sum returns the FNV-1a 64-bit digest of data in one shot.