hash+x86_64 +linux
hash: cryptographic and non-cryptographic hashing algorithms
hash provides a generic interface for use with hashing functions.
Submodules
- adler32: Adler-32 checksum algorithm
- crc16: CRC-16 (Cyclic Redundancy Check) support
- crc32: CRC-32 (Cyclic Redundancy Check) support
- crc64: CRC-64 (Cyclic Redundancy Check) support
- fnv: Fowler–Noll–Vo (FNV) support, for trusted hash map keys
- siphash: SipHash keyed hash function, for untrusted hash map keys
Index
Types
type hash;
Functions
fn bsz(h: *hash) size; fn close(h: *hash) void; fn reset(h: *hash) void; fn sum(h: *hash, buf: []u8) void; fn sz(h: *hash) size; fn write(h: *hash, buf: []u8) size;
Types
type hash[permalink] [source]
type hash = struct { // A stream which only supports writes and never returns errors. stream: io::stream, // Returns the current hash. sum: *fn(hash: *hash, buf: []u8) void, // Resets the hash function to its initial state. reset: nullable *fn(hash: *hash) void, // Size of the hash in bytes. sz: size, // Internal block size of the hash. Writing data to the hash // function in chunks of this size will not require padding to // obtain the final hash. bsz: size, };
The general purpose interface for a hashing function.
Functions
fn bsz[permalink] [source]
fn bsz(h: *hash) size;
Returns the block size of the hash.
fn close[permalink] [source]
fn close(h: *hash) void;
Closes a hash, freeing its resources and discarding the checksum.
fn reset[permalink] [source]
fn reset(h: *hash) void;
Resets the hash function to its initial state.
fn sum[permalink] [source]
fn sum(h: *hash, buf: []u8) void;
Populates the user-provided buffer with the current sum.
fn sz[permalink] [source]
fn sz(h: *hash) size;
Returns the size of the hash in bytes. This is consistent regardless of the hash state.
fn write[permalink] [source]
fn write(h: *hash, buf: []u8) size;
Writes an input to the hash function.