0% found this document useful (0 votes)
158 views5 pages

HMAC Structure

Uploaded by

khoa truong
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
158 views5 pages

HMAC Structure

Uploaded by

khoa truong
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

09:15, 18/10/2022 Chirag's Blog: HMAC | MAC based on Hash Function | HMAC Structure | HMAC Impelmentation | HMAC Pros

AC Impelmentation | HMAC Pros & Cons

Liên kết khác


tigerking1994mta@gmail.com
Bảng

Chirag's Blog
Easy Way to Learn Engineering

Home
Subject
GTU
About Me
Privacy Policy

Subscribe Youtube Tuesday, November 2, 2021 Followers

YouTube 999+ HMAC | MAC based on Hash Function | HMAC Structure | HMAC Người theo

Impelmentation | HMAC Pros & Cons


     HMAC Concept
Facebook
HMAC
stands for HASH Message Authentication Code (HMAC) is a specific technique for
calculating a
Theo dõi 552 Chia s
message authentication code (MAC) involving a combination of
cryptographic hash function and a
 
secret key cryptography.

Search This Blog

Search

Theo dõi

List of Topics
November 2021 (24)
Total Visito

Popular Posts
6 4
What is
RSA
Translate
algorithm Figure: Block diagram of HMAC
| RSA
Algorithm Chọn N
HMAC Structure & Implementation 
explain with example |
RSA algorithm
example | RSA
algorithm steps | how Contact Us
to find private key in
rsa example
Name

RSA Algorithm
Introduction Ron
Rivest, Adi Shamir and
Len Adleman have Email
*

developed this
algorithm (Rivest-
Shamir-Adleman). It is Message
*

a block ciphe...

How does
DES
algorithm
works |
Working Send
of DES Algorithm |
DES Encryption
Process | explain
working of des
algorithm Unique Vis
  DES Algorithm
Introduction Developed
in early 1970’s at IBM Figure: HMAC Structure
Unique Vis
and submitted to NBS.
DES is landmark in
cryptographic
algorithms. DES wor... Chat

AES
Algorithm
in
cryptogra
phy | How
does AES algorithm
works | Working of
AES algorithm | Steps

https://www.chiragbhalodia.com/2021/11/mac-based-on-hash-function.html 1/5
09:15, 18/10/2022 Chirag's Blog: HMAC | MAC based on Hash Function | HMAC Structure | HMAC Impelmentation | HMAC Pros & Cons
of AES encryption |
Explain working of AES
algorithm
        Introduction AES
is symmetric key
cryptographic algorithm
published by NIST. The
algorithm was
proposed by Rijndael.
It is also know...

Figure: HMAC Implementation

HMAC Algorithm
1. Append zeros to the left end of K to create a
b-bit string K+ .
2. XOR (bitwise exclusive-OR) with ipad to
produce the b-bit block Si.
3. Append M to Si.
4. Apply H to the stream generated in step 3.
5. XOR K+ with opad to produce the
b-bit block S0.
6. Append the hash result from step 4 to S0.
7. Apply H to the stream generated in step 6 and
output the result.

 
HMAC Algo Step by Step Explanation
Step – 1: Make the
length of K+ equal to b.

If length
of K+ < b: add 0 bit as required to the left of k.

If length
of K+ = b: In this case, we do not take any action, and proceed to
step 2.

If length
of K+ > b: we need to trim k, for this, we pass K through the
message-digest algorithm(H)
selected for this particular instance of HMAC.

Step – 2: XOR K+
with ipad to produce Si.

XOR K+
(the output of step 1) and ipad to produce a variable called Si.

Here ipad
= 00110110 (36 in Hexadecimal) repeated b/8 times.

Equation,
K+ ⊕ ipad = Si

https://www.chiragbhalodia.com/2021/11/mac-based-on-hash-function.html 2/5
09:15, 18/10/2022 Chirag's Blog: HMAC | MAC based on Hash Function | HMAC Structure | HMAC Impelmentation | HMAC Pros & Cons
Step – 3: Append
original message M to Si

Take the
original message (M) and simply append it to the end of Si.

Equation,
[(K+ ⊕ ipad) || M] = Si || M

Step – 4: Apply
Message-digest algorithm

The
selected message-digest algorithm (e.g. MD5,SHA-l, etc.) is applied to the
output of step 3.

Equation,  H[(K+ ⊕ ipad) || M] = H(Si


|| M)

Step – 5: XOR K+
with opad to produce So

XOR K+
(the output of step 1) with opad to produce a variable called as So.

Here opad
= 01011100 (5C in Hexadecimal) repeated b/8 times.

Equation,
K+ ⊕ opad = So

Step – 6: Append H
to So

Append
the message digest calculated in step 4 to the end of So.

Equation,
(K+ ⊕ opad) || H [(K+ ⊕ ipad) || M] = So ||
H(Si || M)

Step – 7: Apply
Message-digest algorithm

https://www.chiragbhalodia.com/2021/11/mac-based-on-hash-function.html 3/5
09:15, 18/10/2022 Chirag's Blog: HMAC | MAC based on Hash Function | HMAC Structure | HMAC Impelmentation | HMAC Pros & Cons

The
selected message-digest algorithm (e.g., MD5, SHA-I, etc.) is applied to the
output of step 6 (i.e. to
the concatenation of So and H). Finally,
we got MAC.

Equation,
HMAC (K, M) = H [(K+ ⊕ opad) || H [(K+ ⊕ ipad) || M]]

 
Pros & Cons of HMAC
Pros:
HMAC is
faster to compute and verify digital signatures because they use hash functions
rather than
public key.

HMACs can
be used in some cases where the use of public key cryptography is prohibited.
HMACs are
much smaller than digital signatures.

 
Cons:
Key
exchange is main issue, so can’t prevent against replay of message attack.
HMAC
cannot be used if the number of receivers is greater than one.

If multiple parties share the same symmetric key.


How does a receiver know that the message was
prepared and sent by the sender?

To learn more about MAC based on Hash Function (HMAC), Click here

MAC Based on Hash Function | HMAC in network…


network…

   Watch more videos click here.

Chirag Bhalodia
Chirag
on
November 02, 2021

Labels:
Chirag Bhalodia,
HMAC,
HMAC algorithm,
HMAC implementation,
HMAC sturcture,
MAC based on hash function,
Message
authentication code based on hash function

No comments:

Post a Comment

https://www.chiragbhalodia.com/2021/11/mac-based-on-hash-function.html 4/5
09:15, 18/10/2022 Chirag's Blog: HMAC | MAC based on Hash Function | HMAC Structure | HMAC Impelmentation | HMAC Pros & Cons

Enter Comment

Newer Post Home Older Post

Subscribe to:
Post Comments (Atom)

Counter

Copyright © 2022 Chirag Bhalodia, Inc. All rights reserved.. Powered by Blogger.

https://www.chiragbhalodia.com/2021/11/mac-based-on-hash-function.html 5/5

You might also like