Unit-4 HashFunction & DigitalSignature
Unit-4 HashFunction & DigitalSignature
Unit-4
Hash Functions &
Digital Signature Scheme
6. Timing modification
7. Source repudiation Requires Digital
8. Destination repudiation Signature
Where,
= ith bit of the hash code 1 ≤ i ≤ n
m = number of n-bit blocks in the input
= ith bit in jth block
After adding the padding bits the size of the original message/output of
the first step will be 1472 i.e. 64 bits less than an exact multiple of 512
(i.e. 512*3 = 1536).
Length(original message + padding bits) = 512 * i – 64 where i = 1,2,3 . .
- A = 0x67425301
- B = 0xEDFCBA45
- C = 0x98CBADFE
- D = 0x13DCE476
There are four rounds of operations, with each round utilizing all the
sub-blocks, the buffers, and a constant array value.
According to the image above, you see the values being run for a single
buffer A. The correct order is as follows:
The steps mentioned above are run for every buffer and every sub-block.
When the last block’s final buffer is complete, you will receive the MD5
digest.
The non-linear process above is different for each round of the sub-
block.
• Round 1: (b AND c) OR ((NOT b) AND (d))
• Round 2: (b AND d) OR (c AND (NOT d))
• Round 3: b XOR c XOR d
• Round 4: c XOR (b OR (NOT d))There is a circular shift applied to the string.
Message Size < 264 < 264 < 264 < 2128 < 2128
Block Size 512 512 512 1024 1024
Word Size 32 32 32 64 64
Number of
Steps 80 64 64 80 80
F F F
+ + +
Message
schedule
a b c d e f g e 64
W0 K0
Round 0
a b c d e f g e 64
W79 K79
Round 79
+ + + + + + + +
Hi
Unit-4 Hash Fundction & Digital Signature CGPIT 36
SHA - 512 Processing of a Single 1024-Bit Block
Each round takes as input the 512-bit buffer value, abcdefgh, and
updates the contents of the buffer.
At input to the first round, the buffer has the value of the
intermediate hash value, Hi-1.
Each round t makes use of a 64-bit value Wt, derived from the
current 1024-bit block being processed.
The output of the eightieth round is added to the input to the first
round (Hi-1) to produce Hi.
a b c d e f g h
Ch +
Ʃ Maj
+ Ʃ +
+ +
+ Wt
+ Kt
a b c d e f g h
(∑ )
512
𝑇 2= 𝑎 + Maj ( 𝑎 , 𝑏 ,𝑐 )
0
SHA - 512 Round Function Elements
Maj(a,b,c) = (a AND b) XOR (b AND c) XOR (a AND c) Majority of
arguments are true.
Conditional function = (e AND f) XOR (NOT e and g)
∑(a) = ROTR(a,28) XOR ROTR(a,34) XOR ROTR(a,39)
∑(e) = ROTR(e,14) XOR ROTR(e,18) XOR ROTR(e,41)
+ = addition modulo 264
Kt = a 64-bit additive constant.
Wt = a 64-bit word derived from plaintext.
ROTR = Circular right shift rotataion
H E D
E(K, H(M))
S ll H
H(M || S)
It is possible to use a hash function but no encryption for message
authentication.
A and B share a common secret value S.
A computes the hash value over the concatenation of M and S
and appends the resulting hash value to M. Because B possesses S,
it can recompute the hash value to verify the message.
An opponent cannot modify an intercepted message.
Unit-4 Hash Fundction & Digital Signature CGPIT 49
Message authentication method - 4
Source A Destination B
ll H
E D M S
M ll
Compare
ll H K K
S
H(M || S)
E (K, [ M || H(M || S)])
MAC = C ( K , M )
HMAC
MAC
HMAC
MAC
• Advantages
– 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.
• Disadvantages
– Key exchange is a main issues, 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 shares the same symmetric key, how does the receiver know
that the message was prepared and sent by the sender.
S1 S2 … SN
Three Problems
Computational overhead
Message overhead
Security limitations
• Attacker could re-order or re-use signed blocks.
Kpr Sig
H E D
E(PRa, H(M))
H E K K D
E(PRa, H(M))
E (K, [ M || E(PRa, H(M)])