std::sha256
std/src/sha256.mo
SHA-256 (FIPS 180-4).
Public API: Sha256.hash : String -> String (lowercase 64-hex-char
digest). Also exposes Sha256.hash_bytes : List U8 -> List U8 (raw
32-byte digest) for anyone who wants the digest bytes directly rather
than hex text.
Assumption: only the low 32 bits of the bit-length are encoded in the padding footer (the high 32 bits are hardcoded to zero) — correct for any message under 2^32 bits (~512 MiB), which is far beyond what this tree-walking-successor interpreter can hash in reasonable time anyway.
pub instance Copy Sha256State {
def copy (s : Sha256State) : Pair Sha256State Sha256State := Pair.pair s s
}Eight 32-bit registers; duplicating the state is a register copy.
pub def Sha256.hash_bytes (bytes : List U8) : List U8pub def Sha256.hash (s : String) : String