Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
HMAC
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Definition== This definition is taken from RFC 2104: :<math>\begin{align} \operatorname{HMAC}(K, m) &= \operatorname{H}\Bigl(\bigl(K' \oplus opad\bigr) \parallel \operatorname{H} \bigl(\left(K' \oplus ipad\right) \parallel m\bigr)\Bigr) \\ K' &= \begin{cases} \operatorname{H}\left(K\right) & \text{if}\ K\text{ is larger than block size} \\ K & \text{otherwise} \end{cases} \end{align}</math> where : <math>\operatorname{H}</math> is a cryptographic hash function. : <math>m</math> is the message to be authenticated. : <math>K</math> is the secret key. : <math>K'</math> is a block-sized key derived from the secret key, ''K''; either by padding to the right with 0s up to the block size, or by hashing down to less than or equal to the block size first and then padding to the right with zeros. : <math>\parallel</math> denotes [[concatenation]]. : <math>\oplus</math> denotes bitwise [[exclusive or]] (XOR). : <math>opad</math> is the block-sized outer padding, consisting of repeated bytes valued 0x5c. : <math>ipad</math> is the block-sized inner padding, consisting of repeated bytes valued 0x36.{{Ref RFC|2104|rsection=2}} {| class="wikitable" ! [[Hash function]] <code>H</code> ! <code>b</code>, [[byte]]s ! <code>L</code>, [[byte]]s |- | [[MD5]] || 64 || 16 |- | [[SHA-1]] || 64 || 20 |- | [[SHA-2|SHA-224]] || 64 || 28 |- | [[SHA-2|SHA-256]] || 64 || 32 |- | [[SHA-2|SHA-512/224]] || 128 || 28 |- | [[SHA-2|SHA-512/256]] || 128 || 32 |- | [[SHA-2|SHA-384]] || 128 || 48 |- | [[SHA-2|SHA-512]] || 128 || 64<ref>{{cite web |title=FIPS 180-2 with Change Notice 1 |url=https://csrc.nist.gov/publications/fips/fips180-2/fips180-2withchangenotice.pdf |website=csrc.nist.gov}}</ref> |- | [[SHA-3|SHA3-224]] || 144 || 28 |- | [[SHA-3|SHA3-256]] || 136 || 32 |- | [[SHA-3|SHA3-384]] || 104 || 48 |- | [[SHA-3|SHA3-512]] || 72 || 64<ref>{{Cite journal |last=Dworkin |first=Morris |date=4 August 2015 |title=SHA-3 Standard: Permutation-Based Hash and Extendable-Output Functions |url=https://www.nist.gov/publications/sha-3-standard-permutation-based-hash-and-extendable-output-functions |journal=[[Federal Information Processing Standards]] |via=NIST Publications}}</ref> |- | colspan=3 |<code>out = H(in)</code><br /><code>L = length(out)</code><br /><code>b = H's internal block length</code>{{Ref RFC|2104|rsection=2}} |}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)