nx_hmac_sha1.nx
buildroot/runtime/nx_hmac_sha1.nx
about
hmac_sha1.nx -- HMAC with SHA-1 (RFC 2104 + FIPS 198-1).
license_tier: INDEPENDENT_REDERIVE
genealogy_id: international-research-sources/nist/fips_198_1
Interop-only primitive, like sha1.nx itself. HMAC does not
rely on its inner hash's collision resistance (only pseudo-
randomness of the keyed mix), so HMAC-SHA1 remains safe for
authentication even though plain SHA-1 is broken for signatures.
Still widely used:
- TOTP / HOTP (RFC 4226 / 6238 default)
- OAuth 1.0 HMAC-SHA1 signatures
- AWS SigV2 / legacy API auth
- PBKDF2-HMAC-SHA1 (WPA2, older WebCrypto key derivation)
- Older JWT HS1 tokens
Algorithm (RFC 2104):
block_size = 64 bytes for SHA-1
if len(key) > block_size: key = SHA1(key)
key = key || zeros to block_size
ipad = key XOR 0x36 repeated
opad = key XOR 0x5C repeated
tag = SHA1(opad || SHA1(ipad || msg))
Composes sha1.nx. Output is 20 bytes.
Invariants:
HS1 Output = 20 bytes always (HMAC-SHA1 tag length).
HS2 Matches RFC 2202 test vectors (not checked in smoke,
but the algorithm is textbook).
dependencies 2 imports · 6 importers
imports: nx_syscalls.nxnx_sha1.nx
imported by: nx_hkdf_sha1.nxnx_hotp_sha1.nxnx_pbkdf2_sha1.nxnx_stun.nxnx_totp_sha1.nxnx_turn_msgintegrity.nx
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 42 | const HMAC_SHA1_BLOCK: i64 = 64 |
| 43 | const HMAC_SHA1_OUT: i64 = 20 |
functions
| 45 | func hmac_sha1(key: *u8, key_len: i64, called by 9: hkdf_sha1_extracthkdf_sha1_expandmainhotp_sha1_codepb_f_sha1st_message_integrity+3 calls 2: sys_mmapsha1 |
| 97 | func main() -> i64 |