nx_md5_canonical.nx
buildroot/runtime/nx_md5_canonical.nx
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
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
structs
| none |
consts
| 31 | const MD5_MASK32: i64 = 0xFFFFFFFF |
functions
| 34 | func md5_rotl(x: i64, k: i64) -> i64 called by 1: md5_process_block |
| 43 | func md5_s(i: i64) -> i64 called by 1: md5_process_block |
| 74 | func md5_k(i: i64) -> i64 called by 1: md5_process_block |
| 142 | func md5_g(i: i64) -> i64 called by 1: md5_process_block |
| 150 | func md5_process_block(buf: *u8, off: i64, state: *i64) -> i64 |
| 210 | func md5(data: *u8, n: i64, out: *u8) -> i64 called by 10: da_md5_twodigest_auth_ha1digest_auth_responsehmac_md5da_md5_twodigest_auth_ha1+4 calls 2: sys_mmapmd5_process_block |
| 276 | func main() -> i64 |