ITEngineeringTools

HMAC SHA-256 Calculator

Calculate an HMAC-SHA-256 authentication tag from a message and a local UTF-8 or hexadecimal key.

Input

Result

How it works

Select an encoding independently for the key and message. The browser’s Web Crypto API imports the key for HMAC and calculates the tag locally. For cross-system comparisons, check byte encoding, whitespace and whether the other system truncates the tag. Use example keys during testing.

Formula

HMAC = H((K′ XOR opad) || H((K′ XOR ipad) || message)).

Practical examples

Text interoperability check

Message: The quick brown fox jumps over the lazy dog
Key: key
Message encoding: UTF-8
Key encoding: UTF-8

f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8

RFC 4231 test case 1

Message: Hi There
Key: 0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b
Message encoding: UTF-8
Key encoding: Hex

b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7

RFC 4231 test case 2

Message: what do ya want for nothing?
Key: Jefe
Message encoding: UTF-8
Key encoding: UTF-8

5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843

Technical references