Module

std::hash

Hash Module

Deterministic hashing foundations for collections and user-defined keys.

The default hasher uses 64-bit FNV-1a with a fixed offset basis and no randomized seeding. Hashes are therefore deterministic for a given stdlib and compiler version.

writeStr hashes NUL-terminated str data. Owned String values should hash all owned bytes without routing through raw toStr().

namespace __hash_rt

Functions

function ignis_hash_fnv1a_cstr(state: u64, value: str): u64

Continues an FNV-1a hash over a NUL-terminated C string.

Records

record Hasher

Deterministic 64-bit FNV-1a hasher used by std collections.

The hasher has a fixed seed and byte order, so output is stable across runs for the same std implementation. It is intended for hash tables and tests, not for cryptographic or adversarial-input protection.

Members
state: u64

Current FNV-1a state.

static new(): Hasher

Creates a hasher initialized to the FNV offset basis.

finish(&self): u64

Returns the current 64-bit hash state without resetting the hasher.

reset(&mut self): void

Resets this hasher to its initial offset-basis state.

writeBoolean(&mut self, value: boolean): void

Mixes a boolean as a single canonical byte (0 or 1).

writeByte(&mut self, value: u8): void

Mixes one byte into the current FNV-1a state.

writeChar(&mut self, value: char): void

Mixes a byte-backed Ignis char value.

writeI16(&mut self, value: i16): void

Mixes an i16 by its two’s-complement little-endian representation.

writeI32(&mut self, value: i32): void

Mixes an i32 by its two’s-complement little-endian representation.

writeI64(&mut self, value: i64): void

Mixes an i64 by its two’s-complement little-endian representation.

writeI8(&mut self, value: i8): void

Mixes an i8 by its two’s-complement byte representation.

writeStr(&mut self, value: str): void

Mixes a NUL-terminated string view.

Hashing stops at the first NUL byte because str is represented as a C string view. Owned String hashing should not use this for interior-NUL preserving behavior.

writeU16(&mut self, value: u16): void

Mixes a u16 in little-endian byte order.

writeU32(&mut self, value: u32): void

Mixes a u32 in little-endian byte order.

writeU64(&mut self, value: u64): void

Mixes a u64 in little-endian byte order.

Traits

trait Eq

Canonical equality marker trait.

Types marked with @implements(Eq) must provide equals(&self, other: &ConcreteType): boolean.

trait Hash

Trait for values that can feed their canonical bytes into a Hasher.

Implementations must be consistent with Eq: if two values compare equal, they must write the same byte sequence to the hasher.

Members
hash(&self): void

Functions

function equals(value: str, other: str): boolean

Implements byte-wise equality for NUL-terminated string views.

Comparison stops at the first NUL byte in either view. Use owned String equality when interior NUL bytes must participate in comparison.

function equals(value: str, other: str): boolean

Implements byte-wise equality for NUL-terminated string views.

Comparison stops at the first NUL byte in either view. Use owned String equality when interior NUL bytes must participate in comparison.

function equals(value: str, other: str): boolean

Implements byte-wise equality for NUL-terminated string views.

Comparison stops at the first NUL byte in either view. Use owned String equality when interior NUL bytes must participate in comparison.

function equals(value: str, other: str): boolean

Implements byte-wise equality for NUL-terminated string views.

Comparison stops at the first NUL byte in either view. Use owned String equality when interior NUL bytes must participate in comparison.

function equals(value: str, other: str): boolean

Implements byte-wise equality for NUL-terminated string views.

Comparison stops at the first NUL byte in either view. Use owned String equality when interior NUL bytes must participate in comparison.

function equals(value: str, other: str): boolean

Implements byte-wise equality for NUL-terminated string views.

Comparison stops at the first NUL byte in either view. Use owned String equality when interior NUL bytes must participate in comparison.

function equals(value: str, other: str): boolean

Implements byte-wise equality for NUL-terminated string views.

Comparison stops at the first NUL byte in either view. Use owned String equality when interior NUL bytes must participate in comparison.

function equals(value: str, other: str): boolean

Implements byte-wise equality for NUL-terminated string views.

Comparison stops at the first NUL byte in either view. Use owned String equality when interior NUL bytes must participate in comparison.

function equals(value: str, other: str): boolean

Implements byte-wise equality for NUL-terminated string views.

Comparison stops at the first NUL byte in either view. Use owned String equality when interior NUL bytes must participate in comparison.

function equals(value: str, other: str): boolean

Implements byte-wise equality for NUL-terminated string views.

Comparison stops at the first NUL byte in either view. Use owned String equality when interior NUL bytes must participate in comparison.

function equals(value: str, other: str): boolean

Implements byte-wise equality for NUL-terminated string views.

Comparison stops at the first NUL byte in either view. Use owned String equality when interior NUL bytes must participate in comparison.

function hash(value: str, hasher: &mut Hasher): void

Implements Hash for NUL-terminated string views.

function hash(value: str, hasher: &mut Hasher): void

Implements Hash for NUL-terminated string views.

function hash(value: str, hasher: &mut Hasher): void

Implements Hash for NUL-terminated string views.

function hash(value: str, hasher: &mut Hasher): void

Implements Hash for NUL-terminated string views.

function hash(value: str, hasher: &mut Hasher): void

Implements Hash for NUL-terminated string views.

function hash(value: str, hasher: &mut Hasher): void

Implements Hash for NUL-terminated string views.

function hash(value: str, hasher: &mut Hasher): void

Implements Hash for NUL-terminated string views.

function hash(value: str, hasher: &mut Hasher): void

Implements Hash for NUL-terminated string views.

function hash(value: str, hasher: &mut Hasher): void

Implements Hash for NUL-terminated string views.

function hash(value: str, hasher: &mut Hasher): void

Implements Hash for NUL-terminated string views.

function hash(value: str, hasher: &mut Hasher): void

Implements Hash for NUL-terminated string views.

Constants

const FNV_OFFSET_BASIS: u64
const FNV_PRIME: u64