std/Sha256.hash
Pure-Milo SHA-256 (FIPS 180-4) — no platform crypto dependency. Constant-time by construction (every branch and memory access is on public data) and WCET-analyzable: the round loops are fixed counts, so milo wcet resolves a worst-case time bound and milo safety confirms termination.
milo
from "std/sha256" import { Sha256 }Functions
Sha256.hash
milo
fn Sha256.hash(input: &string): stringSHA-256 digest as a 64-char lowercase hex string.
Sha256.bytes
milo
fn Sha256.bytes(input: &string): stringSHA-256 digest as 32 raw bytes. Use this when the digest feeds further bytes (HMAC, key derivation); Sha256.hash wraps it for the common hex case.
milo
let hex = Sha256.hash("hello world")
// "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9"