code wiki / (root) / nx_md5_canonical.nx

nx_md5_canonical.nx

buildroot/runtime/nx_md5_canonical.nx

8942 B291 linesdepth 2pulls 2 transitivereach 7 importersview sourcekind tooltopic md5
docsdependenciesstructsconstsfunctions

about

md5.nx -- RFC 1321 MD5 hash. BROKEN cryptographically (collisions constructible in seconds on a laptop since Wang 2004). Never use for signatures. Still needed for interop: - HTTP Digest authentication (RFC 7616 default) - ETag generation in legacy servers (when not using sha) - .iso / .zip / .torrent integrity checks - git-lfs pointer checksums - Content-MD5 header (deprecated but still seen) Algorithm (RFC 1321): Padding: append 1 bit, zero-pad, append 64-bit LE length until total length is multiple of 512 bits. Process in 512-bit blocks; 64 rounds over 4-word state (A, B, C, D) each updated through F/G/H/I round functions. Invariants: M1 Empty string hashes to d41d8cd98f00b204e9800998ecf8427e. M2 State mmap'd per call; no globals. M3 Output is 16 bytes.

dependencies 1 imports · 5 importers

nx_syscalls.nx nx_md5_canonical.nx digest_auth.nx hmac_md5.nx nx_digest_auth.nx nx_hmac_md5.nx nx_md5_kat.nx

imports: nx_syscalls.nx

imported by: digest_auth.nxhmac_md5.nxnx_digest_auth.nxnx_hmac_md5.nxnx_md5_kat.nx

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap md5 sys_mmap ↻ md5_process_block sys_mmap ↻ md5_g md5_k md5_rotl md5_s

structs

none

consts

31const MD5_MASK32: i64 = 0xFFFFFFFF

functions

34func md5_rotl(x: i64, k: i64) -> i64
called by 1: md5_process_block
43func md5_s(i: i64) -> i64
called by 1: md5_process_block
74func md5_k(i: i64) -> i64
called by 1: md5_process_block
142func md5_g(i: i64) -> i64
called by 1: md5_process_block
150func md5_process_block(buf: *u8, off: i64, state: *i64) -> i64
called by 1: md5 calls 5: sys_mmapmd5_gmd5_kmd5_rotlmd5_s
210func md5(data: *u8, n: i64, out: *u8) -> i64
276func main() -> i64
calls 2: sys_mmapmd5