Skip to main content

Module sha256

Module sha256 

Source
Expand description

A std-only SHA-256, because the sha2 crate’s generic stack costs tens of kB. Every download is verified with it and the cache is keyed by it. Names inside compress follow FIPS 180-4, so the code reads against the spec.

Structs§

Sha256

Constants§

BLOCK_SIZE 🔒
H0 🔒
The first 32 bits of the fractional parts of the square roots of the first 8 primes (FIPS 180-4 §5.3.3).
K 🔒
The first 32 bits of the fractional parts of the cube roots of the first 64 primes (FIPS 180-4 §4.2.2).
LENGTH_OFFSET 🔒
Where the message length starts inside the final padded block.

Functions§

hex
Lowercase hex, the form the manifest and the cache use.
hex_digest
The lowercase hex digest of data already in memory.
hex_digest_of_file
The lowercase hex digest of a file, read in chunks rather than whole.