code wiki / (root) / pbkdf2_sha1.nx

pbkdf2_sha1.nx

buildroot/runtime/pbkdf2_sha1.nx

3765 B115 linesdepth 4pulls 5 transitivereach 0 importersview sourcekind tooltopic pbkdf2
docsdependenciesstructsconstsfunctions

about

pbkdf2_sha1.nx -- PBKDF2 key derivation with HMAC-SHA1. RFC 2898 / PKCS#5 v2.0. The SHA-1-based variant was once the web standard for password hashing and is still used by: - WPA2 PSK -> PMK derivation (802.11i-2004 requires PBKDF2-SHA1 with 4096 iterations) - Older OS X Keychain + iOS data protection - 1Password .agilekeychain / .keychain vault decryption - Legacy JWT \"PBES2\" JOSE key derivation For new password hashing use Argon2id (memory-hard) or at least PBKDF2-SHA-256 with iter_count >= 600000 (OWASP 2023). Algorithm (ยง5.2): DK = T_1 || T_2 || ... || T_l T_i = F(password, salt, c, i) F(P, S, c, i) = U_1 XOR U_2 XOR ... XOR U_c U_1 = HMAC-SHA1(P, S || INT(i)) INT(i) is u32 big-endian U_j = HMAC-SHA1(P, U_{j-1}) for j = 2..c Composes hmac_sha1.nx. Invariants: PB1 Output length `dk_len` in bytes; at most 2^32 - 1 blocks (not checked; callers requesting > 10MB keys are daft). PB2 iterations must be >= 1; we treat 0 as \"no stretching\" which RFC doesn't define. PB3 Salt + password byte-exact; no UTF-8 normalisation.

dependencies 2 imports · 0 importers

syscalls.nx hmac_sha1.nx pbkdf2_sha1.nx

imports: syscalls.nxhmac_sha1.nx

imported by: nobody (leaf or entry point)

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

main pbkdf2_sha1 pb_f_sha1 hmac_sha1 sha1 sys_mmap sha1_process_block if_ge

structs

none

consts

33const PB_HLEN: i64 = 20 // HMAC-SHA1 output size

functions

36func pb_f_sha1(password: *u8, pass_len: i64,
called by 1: pbkdf2_sha1 calls 1: hmac_sha1
80func pbkdf2_sha1(password: *u8, pass_len: i64,
called by 1: main calls 1: pb_f_sha1
107func main() -> i64 {
calls 1: pbkdf2_sha1