HMAC-SHA-256
Message authentication code of a message under a key, checked against RFC 4231.

Overview & Cryptographic Context
HMAC (Hash-based Message Authentication Code), standardized in RFC 2104 and NIST FIPS 198-1, constructs a PRF and message authentication code from an unkeyed cryptographic hash function H using two nested passes with inner (0x36) and outer (0x5c) XOR pads:
HMAC(K, m) = H((K' ⊕ opad) ‖ H((K' ⊕ ipad) ‖ m))
Because Merkle-Damgård hashes like SHA-256 are vulnerable to length-extension attacks when used naively as H(K ‖ m), the outer hash invocation over the inner 32-byte digest prevents an attacker from appending data without knowing K. This workflow reproduces RFC 4231 §4.3 (Test Case 2), authenticating the ASCII phrase "what do ya want for nothing?" under the 4-byte ASCII key "Jefe" (zero-padded internally to the 64-byte SHA-256 block size B).
Pipeline Architecture & Wiring Flow
- Key & Message Ingress (
Workflow Input): Supplies the secretKey(4 bytes,4a656665) and the messageData(28 bytes). - Keyed Hash Computation (
HMAC Generator): Configured withalgorithm = "SHA-256". The node automatically normalizes keys shorter or longer than 64 bytes per RFC 2104 before computing the 32-byte tag. - MAC Output (
Workflow Output): Emits the resulting 32-byte (256-bit) authentication code on theMACoutput port.
Nodes & Configuration
| Node | Node Role & Key Parameters | Count |
|---|---|---|
| Workflow Input | Supplies Key and Data byte streams | 1 |
| HMAC Generator | Configured with algorithm = "SHA-256" | 1 |
| Workflow Output | Collects the 32-byte MAC output | 1 |
Inputs, Outputs & Test Vector Verification
Verification Source: RFC 4231 §4.3 (Test Case 2, HMAC-SHA-256)
Inputs
| Name | Type | Value (Hex) |
|---|---|---|
Key | bytes (4 B, ASCII "Jefe") | 4a656665 |
Data | bytes (28 B, ASCII "what do ya want for nothing?") | 7768617420646f2079612077616e7420666f72206e6f7468696e673f |
Expected Outputs
| Name | Type | Value (Hex) |
|---|---|---|
MAC | bytes (32 B) | 5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843 |