std::digest
Checksums and hashes of bytes: CRC-32, 64-bit FNV-1a and SHA-256.
Source: std/digest.volt
Types
struct std::digest::sha256
struct sha256SHA-256 (FIPS 180-4), fed in pieces: update with each, then finish for the 32-byte digest. Make one with sha256::new()
| Field | |
|---|---|
h: u32[8] | the state |
block: u8[64] | bytes waiting for a whole block |
filled: usize | how many of block are in use |
total: u64 | bytes taken so far |
Methods
attach fn new(static this: std::digest::sha256) -> std::digest::sha256a SHA-256 hasher with nothing fed in yet
attach fn update(this: std::digest::sha256&, data: u8[..]) -> voidfeed data in
attach fn update(this: std::digest::sha256&, text: str) -> voidattach fn finish(this: std::digest::sha256&) -> u8[32]the digest of everything fed in (the hasher is used up: make a new one for more)
Functions
std::digest::crc32
fn crc32(data: u8[..]) -> u32the CRC-32 of data, as zip, gzip and PNG compute it ("123456789" gives cbf43926)
std::digest::crc32
fn crc32(text: str) -> u32std::digest::fnv1a
fn fnv1a(data: u8[..]) -> u64the 64-bit FNV-1a hash of data: fast and simple, for hash tables and fingerprints (not for anything an attacker controls)
std::digest::fnv1a
fn fnv1a(text: str) -> u64std::digest::sha256_of
fn sha256_of(data: u8[..]) -> u8[32]the digest of data in one call
std::digest::sha256_of
fn sha256_of(text: str) -> u8[32]