std/sha256
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, sha256Bytes }Functions
sha256
milo
fn sha256(input: &string): stringSHA-256 digest as a 64-char lowercase hex string.
sha256Bytes
milo
fn sha256Bytes(input: &string): stringSHA-256 digest as 32 raw bytes. Use this when the digest feeds further bytes (HMAC, key derivation); sha256 wraps it for the common hex case.
milo
let hex = sha256(&"hello world")
// "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9"