md5.nx
buildroot/runtime/md5.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 · 0 importers
imports: syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 25 | const MD5_MASK32: i64 = 0xFFFFFFFF |
functions
| 28 | func md5_rotl(x: i64, k: i64) -> i64 {
called by 1: md5_process_block |
| 36 | func md5_s(i: i64) -> i64 {
called by 1: md5_process_block |
| 67 | func md5_k(i: i64) -> i64 {
called by 1: md5_process_block |
| 135 | func md5_g(i: i64) -> i64 {
called by 1: md5_process_block |
| 143 | func md5_process_block(buf: *u8, off: i64, state: *i64) -> i64 { |
| 203 | func md5(data: *u8, n: i64, out: *u8) -> i64 { |
| 269 | func main() -> i64 {
calls 1: md5 |