SlideShare a Scribd company logo
Cryptographic Hash Functions
Message Authentication
Digital Signatures
Abstract
We will discuss
• Cryptographic hash functions
• Message authentication codes
– HMAC and CBC-MAC
• Digital signatures
2
Encryption/Decryption
• Provides message confidentiality.
• Does it provide message authentication?
3
Bob receives a message from Alice, he wants to know
(Data origin authentication) whether the message was
really sent by Alice;
(Data integrity) whether th
Message Authentication
m•
g
g
message authentication code
e message has been modified.
Solutions:
Alice attaches a (MAC)
to the message.
Or she attach digital signatures a to the message.e
•
g
g
4
A hash function maps from a domain to a smaller range,
typically many-to-one.
Properties required of a hash function depend on its
applications.
Applications:
Fast loo
Hash function
•
•
•
g kup (hash tables)
Error detection/correction
cryptographic haCryp sh ftography unctions:
Others
g
g
g
5
*
*
: , | | | |.
For example, :{0,1} {0,1}
:{0,1}
:{0,1} {0,1} , .
If
Hash functi
is
ons:
Cryptographic hash function
n
n
k l
h X Y X Y
h
h Z
h k l
X
• → >
• →
→
→ >
•
( )
finite, is also called a compression function.
A classical application: users/clients passwords are
stored in a file
not as username, password ,
but as username,
h
h
•
( ) using some
cryptographic hash fu
(password
nctio
)
n .h
6
Pre-image: if ( ) , is a pre-image of .
Each hash value typically has multiple pre-images.
Collision: a pair of ( , ), , s.t. ( ) ( ).
A hash function is said t
Security requirements
h m y m y
m m m m h m h m
• =
•
′ ′ ′• ≠ =
o be:
if it is computationally infeasible to
find a pre-image of a hash value.
if it is computationally in
Pre-image resistant
C feasible to
find a col
ollision re
lision
sistant
.
A hash fun
•
•
• cryptographic hash functioction is a
if it is collision resista
n
nt.
7
8
• Collision-resistant hash functions can be
built from collision-resistant compression
functions using Merkle-Damgard
construction.
*
*
hash
compression
Construct a cryptographic function :{0,1} {0,1}
from a function :{0,1} {0,1} .
1. For {0,1} , add to so that | '| ispadding
Merkle-Damgard construction
n
n b n
h
f
m m m
+
• →
→
∈
1 2
0 1
a multiple of .
Let padded ' , each of length .
(padding = 10...0 | |, where | | is the length of )
3. Let IV and ( ) for 1 .
4. The hash value (
k i
i i i
b
m m m m m b
m m m
v v v m i k
h
f −
=
= = ≤ ≤
K
P
) .
If is collision-resistant, then is colliTheor sion-resistant.em.
km v
f h
=
Merkle-Damgard Construction
Compression function :{0,1} {0,1}n b n
f +
→
m1 m2 m3 mk
f f fIV
v0 v1 v2 vk
… f h(m)
64
an NIST standard.
using Merkle-Damgard construction.
input message is divided into blocks with padding.
padding = 10...0 , where {0,1} indicates | | in
The Secure Hash Algorithm (SHA-1)
m
m
•
•
•
• ∈l l
64
0 15
0 4
binary.
thus, message length limited to | | 2 1.
block = 512 bits = 16 words = .
IV a constant of 160 bits = 5 words = .
resulting hash value: 160 bits.
underlying compre
m
W W
H H
• ≤ −
•
• =
•
•
KP P
KP P
160 512 160
ssion function :{0,1} {0,1} ,
a series (80 rounds) of , , , , +, and Rotate on
words ' & 's.i i
f
W s H
+
→
∧ ∨ ⊕ ¬
{ }1 2
An attack is to produce a collision.
Birthday attack: randomly generate a set of messages
, , , , hoping to produce a collision.
160 is big enough to resist birthda
Is SHA-1 secure?
km m m
n
•
•
• =
K
y attacks .
There is no mathematical proof for its collision resistancy.
In 2004, a collision for a "58 rounds" SHA-1 was produced.
(The compression function of SHA-1 has 80 roun
for n
ds.)
ow
N
•
•
• ewer SHA's have been included in the standard:
SHA-256, SHA-384, SHA-512.
12
In a group of people, what is the probability
that at least two people have
Having the same birthday is a
the same bi
collision?
Birthday problem:
Birthday
rthday?
1 2 withparadox:
k
p
•
• ≥
g
as small as 23.
Consider a hash function :{0,1} {0,1} .
If we randomly generate messages, the probability
of having a collision depends on .
To resist birthday attack, we choose to
n
k
h
k
n
n
∗
• →
•
• be sufficiently large that
it will take an infeasibly large to have a non-negligible probability
of collision.
k
modification detection codes (MDC)
Storing passwords
Used to produce
( ), called an MDC, is stored in a secure place;
if is modified, we
Applications of cryptographic hash functions
h m
m
•
•
g
g can detect it;
protecting the integrity of .
We will see some other applicati son .
m
•
g
14
Bob receives a message from Alice, he wants to know
(Data origin authentication) whether the message was
really sent by Alice;
(Data integrity) whether th
Message Authentication
m•
g
g
message authentication code
e message has been modified.
Solutions:
Alice attaches a (MAC)
to the message.
Or she attach digital signatures a to the message.e
•
g
g
15
Message authentication protocol:
1. Alice and Bob share a secret key .
2. Alice sends MAC ( ) to Bob.
3. Bob authenticates the received MAC
by checking if MAC MAC ( )?
MAC
k
k
k
m m
m
m
•
′ ′
′ ′=
•
P
P
MAC ( ) is called a .
Security requirement: infeasible to produce a valid pair
( , MA
message auth
C ( )) w
entication
ithout knowing the key
e
.
c dok
k
m
x x k
•
16
A common way to construct a MAC is to incorporate a
secret key into a fixed hash function (e.g. SH
Insecure:
A-1).
MAC ( ) ( ) ( ) wit IVh
Constructing MAC from a hash
k k
k h
m h m h m k
•
•
= = =g
g MAC ( ) ( ) ( )k km h m h k m= = P
17
m = m1 m2 m3 ms
f f fIV … f h(m)
k X X hk(m)
fhk(m) hk(m||ms+1)
ms+1
1
( ) ( ) with IV .
(For simplicity, without
Insecure:
Easy to forge:
( , ( )),
padd
where
ing)
k
s
k
m
M
h m
AC m h
m m
m k
m +
•
′
′ =
=
•
′
=
P
( )2 1
1 2
A FIPS standard for constructing MAC from a hash
function . Conceptually,
HMAC ( ) ( )
where and are two keys generated from .
Various
HMAC (Hash-based MAC)
k m k k m
k
h
k k
h h
•
=
•
P P
( )
hash functions (e.g., SHA-1, MD5) may be used for .
If we use , then HMAC is as follows:
HMAC ( ) ( )
where
is padded with 0's to 512
SHA-1
SHA-1 SHA
bits
1-k
h
m k opad k ipad m
k
•
= ⊕ ⊕
g
P P
3636 36 (x036 repeated 64 times)
5c5c 5c (x05c repeated 64 times)
ipad
opad
=
= L
g
g
L
A FIPS and ISO standard.
One of the most popular MACs in use.
Use a block cipher in CBC mode with a fixed, public IV.
Called DES CBC-MAC if the block cipher is DES.
Let :{0,1} {0,1
CBC-MAC
n
E
•
•
•
•
• →
1 2
0
1
} be a block cipher.
CBC-MAC( , )
, where | | .
IV (typically 0 )
for 1 to do
( )
return( )
n
l i
n
i k i i
l
m k
m m m m m n
c
i l
c E c m
c
−
•
= =
¬
¬
¬ ⊕
KP P P
20
Cipher Block Chaining (CBC)
21
A refined version of CBC-MAC.
Adopted by NIST for use with AES and 3DES.
Use two keys: , (assuming is a multiple of ).
Let :{0,1} {0,1} be a block cipher.
CM
CMAC (Cipher-based MAC)
n n
k k m n
E
•
•
′•
• →
•
1 2
0
1
1
AC( , )
, where | | .
IV (typically 0 )
for 1 to 1 do
( )
( )
return( )
l i
n
i k i i
l k l l
l
m k
k
m m m m m n
c
i l
c E c m
c E c m
c
−
−
= =
¬
¬ −
′⊕
¬ ⊕
¬ ⊕
KP P P
22
RSA can be used for digital signatures.
A digital signature is the same as a MAC except that
the tag (signature) is produced using a public-key
cryptosystem.
Digital
Digital Signatures
•
•
• signatures are used to provide message
authentication an non-repudiatd ion.
Message m MACk(m)
Message m Sigpr(m)
Digital signature protocol:
1. Bob has a key pair ( , ).
2. Bob sends Sig ( ) to Alice.
3. Alice verifies the received
by checking if Verify ( ).
Sig ( ) is calle
pr
pu
pr
pr pu
m m
m s
s m
m
•
′ ′
′ ′=
•
P
P
d a .
Security requirement: infeasible to forge a valid
pair ( , S
signatu
ig ( )) without knowing
re for
.prm m pr
m
•
MCE D
PUBob PRBob
Alice Bob
M
MSE D
PUBob PRBob
Alice Bob
Verify Sign
Encryption (using RSA):
Digital signature (using RSA-1
):
E(S)
=M?
*
are generated as for RSA encryption:
Public key: . Private key: .
a message : ( ) mod .
That is,
Keys
Signin
( , ) ( , )
g
RSA Signature
d
n PR
PU n e PR n d
m Z D m m nσ
σ
∈• =
= =
•
=
1
RSA ( ).
a signature ( , ) :
check if ( ) mod , or RSA( ).
Only the key's owner can sign,
Ver
but anybody can ver
ify
ify.
ing
e
PU
m
m
m E n m
σ
σ σ σ
−
=
=
•
= =
•
*
RSA
1. Every message is a valid signature for
its ciphertext : RSA( ).
Encryption (using Bob's public key):
Existential forgeries
Sig
:
Security of RSA Signature
nm Z
c m
m c
∈
=

•
→
1
RSA
1 2 1 2
1 2 1 2
n ( using Bob's private key):
2. If Bob signed and , then the signature for
can be easily forged
if
hash a
: ( ) ( ) ( ).
Counterme nd siasure gn: :
m c
m m m m
m m m mσ σ σ
σ
−
•
¬ 
=
Sign ( ( )),
using some collision resistant hash function .
PR h m
h
=
Does hash-then-sign make RSA signature secure
against chosen-message attacks?
Question:
Answer:
random oracleYes, is a i.e.,
is a
all
if full-
random or
d
a
,
cle mapping {0
omainh
h
•
•
g *
,1}
( is the full domain of RSA)
n
n
Z
Z
→
g
{ }
160
In practice, is full-domain.
For instance, the range of SHA-1 is {0,1} ,
while 0,1,...,2 1 , wi
Problem with full-
th 1024.
domain hash:
Desired: a sec
no
ure signature scheme
t
n
n
h
Z n
•
= − ≥
•
that does not
require a full-domain hash.
*
pad
Hash function :{0,1} {0,1} (not full domain).
| |. (E.g., SHA-1, 160; RSA, 1024.)
Idea:
Probabilistic signature scheme
l
Nh Z
l n N l n
m m r
→ ⊂
< = = =
•
• → P *
hash
expand 1
si
1
gn 1
{0,1}
( ) {0,1}
( ) {0,1}
RSA ( )
( )0n l
l
nk
r
w h m r
y w G w
yσ
− − −
−
−
∈
→ = ∈
→ = ⊕ ∈
→ =
PP
P
1
where {0,1}
:{0,1} {0,1} (pseudorandom generator)
N
k
l n l
Z
r
G − −
∈
∈
→
*
11 2 2
1
a message {0,1} :
1. choose a random {0,1} ; compute ( );
2. compute ;( ) ( ) // //
3. The signatu
Signing
re is RSA ( ).
k
m
r w h m r
G G Gw
y
y w r G G w
σ −
∈
∈
=
=
=
=
•
⊕P P
P
P
PSS is secure against chosen-message attacks in the
random oracle model (i.e., if and are random oracles).
PSS is adopted in PKCS #1 v.2.1.
Hash functions such as SHA-1
Remarks
are used f
h G
•
•
•
1 2
or and .
For instance,
let 1024, and 160
let = SHA-1
( , )( ) ( ) ( 0) ( 1) ( 2), ...
h G
n l k
h
G G w G w h w h w h w
= = =
= =
•
P P P PP

More Related Content

What's hot

Cryptography and Message Authentication NS3
Cryptography and Message Authentication NS3Cryptography and Message Authentication NS3
Cryptography and Message Authentication NS3koolkampus
 
Public key cryptography and message authentication
Public key cryptography and message authenticationPublic key cryptography and message authentication
Public key cryptography and message authentication
CAS
 
Message Authentication: MAC, Hashes
Message Authentication: MAC, HashesMessage Authentication: MAC, Hashes
Message Authentication: MAC, Hashes
Shafaan Khaliq Bhatti
 
Hash Function & Analysis
Hash Function & AnalysisHash Function & Analysis
Hash Function & Analysis
Pawandeep Kaur
 
Hash crypto
Hash cryptoHash crypto
Hash crypto
Harry Potter
 
Cryptographic Hashing Functions
Cryptographic Hashing FunctionsCryptographic Hashing Functions
Cryptographic Hashing FunctionsYusuf Uzun
 
Is unit 5_message authentication and hash functions
Is unit 5_message authentication and hash functionsIs unit 5_message authentication and hash functions
Is unit 5_message authentication and hash functionsSarthak Patel
 
18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network Security 18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network Security
Kathirvel Ayyaswamy
 
Message Authentication
Message AuthenticationMessage Authentication
Message Authentication
Ram Dutt Shukla
 
Message digest 5
Message digest 5Message digest 5
Message digest 5
Tirthika Bandi
 
Cryptography Ashik
Cryptography AshikCryptography Ashik
Cryptography Ashik
Ashik Iqbal
 
Message authentication
Message authenticationMessage authentication
Message authentication
CAS
 
Cryptographic hash function md5
Cryptographic hash function md5Cryptographic hash function md5
Cryptographic hash function md5
Khulna University, Khulna, Bangladesh
 
Pgp smime
Pgp smimePgp smime
Pgp smime
Tania Agni
 
5. message authentication and hash function
5. message authentication and hash function5. message authentication and hash function
5. message authentication and hash function
Chirag Patel
 
Message Authentication Code & HMAC
Message Authentication Code & HMACMessage Authentication Code & HMAC
Message Authentication Code & HMAC
Krishna Gehlot
 
Hash Techniques in Cryptography
Hash Techniques in CryptographyHash Techniques in Cryptography
Hash Techniques in CryptographyBasudev Saha
 

What's hot (20)

Cryptography and Message Authentication NS3
Cryptography and Message Authentication NS3Cryptography and Message Authentication NS3
Cryptography and Message Authentication NS3
 
Public key cryptography and message authentication
Public key cryptography and message authenticationPublic key cryptography and message authentication
Public key cryptography and message authentication
 
Message Authentication: MAC, Hashes
Message Authentication: MAC, HashesMessage Authentication: MAC, Hashes
Message Authentication: MAC, Hashes
 
Hash Function & Analysis
Hash Function & AnalysisHash Function & Analysis
Hash Function & Analysis
 
Hash crypto
Hash cryptoHash crypto
Hash crypto
 
Cryptographic Hashing Functions
Cryptographic Hashing FunctionsCryptographic Hashing Functions
Cryptographic Hashing Functions
 
Is unit 5_message authentication and hash functions
Is unit 5_message authentication and hash functionsIs unit 5_message authentication and hash functions
Is unit 5_message authentication and hash functions
 
18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network Security 18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network Security
 
Message Authentication
Message AuthenticationMessage Authentication
Message Authentication
 
Message digest 5
Message digest 5Message digest 5
Message digest 5
 
Cryptography Ashik
Cryptography AshikCryptography Ashik
Cryptography Ashik
 
MD5Algorithm
MD5AlgorithmMD5Algorithm
MD5Algorithm
 
Message authentication
Message authenticationMessage authentication
Message authentication
 
Cryptographic hash function md5
Cryptographic hash function md5Cryptographic hash function md5
Cryptographic hash function md5
 
Pgp smime
Pgp smimePgp smime
Pgp smime
 
5. message authentication and hash function
5. message authentication and hash function5. message authentication and hash function
5. message authentication and hash function
 
Message Authentication Code & HMAC
Message Authentication Code & HMACMessage Authentication Code & HMAC
Message Authentication Code & HMAC
 
Hash Techniques in Cryptography
Hash Techniques in CryptographyHash Techniques in Cryptography
Hash Techniques in Cryptography
 
Secure hashing algorithm
Secure hashing algorithmSecure hashing algorithm
Secure hashing algorithm
 
Network Security Lec5
Network Security  Lec5Network Security  Lec5
Network Security Lec5
 

Viewers also liked

Introductory Lecture on Cryptography and Information Security
Introductory Lecture on Cryptography and Information SecurityIntroductory Lecture on Cryptography and Information Security
Introductory Lecture on Cryptography and Information SecurityBikramjit Sarkar, Ph.D.
 
Class 16
Class 16Class 16
Public Key Cryptography
Public Key CryptographyPublic Key Cryptography
Public Key Cryptography
Israel Herraiz
 
Computer Security Lecture 4: Block Ciphers and the Data Encryption Standard
Computer Security Lecture 4: Block Ciphers and the Data Encryption StandardComputer Security Lecture 4: Block Ciphers and the Data Encryption Standard
Computer Security Lecture 4: Block Ciphers and the Data Encryption Standard
Mohamed Loey
 
A Tutorial on Linear and Differential Cryptanalysis by Howard M. Heys
A Tutorial on Linear and Differential Cryptanalysis by Howard M. HeysA Tutorial on Linear and Differential Cryptanalysis by Howard M. Heys
A Tutorial on Linear and Differential Cryptanalysis by Howard M. Heys
Information Security Awareness Group
 
Data encryption standard
Data encryption standardData encryption standard
Data encryption standard
Mohammad Golyani
 
Public Key Cryptography and RSA algorithm
Public Key Cryptography and RSA algorithmPublic Key Cryptography and RSA algorithm
Public Key Cryptography and RSA algorithm
Indra97065
 
Public Key Cryptography
Public Key CryptographyPublic Key Cryptography
Public Key Cryptography
Gopal Sakarkar
 
PUBLIC KEY ENCRYPTION
PUBLIC KEY ENCRYPTIONPUBLIC KEY ENCRYPTION
PUBLIC KEY ENCRYPTIONraf_slide
 
Data encryption, Description, DES
Data encryption, Description, DESData encryption, Description, DES
Data encryption, Description, DES
Huawei Technologies
 
Cryptography
CryptographyCryptography
Cryptography
Sidharth Mohapatra
 
Cryptography
CryptographyCryptography
Cryptography
Shivanand Arur
 
Cryptography.ppt
Cryptography.pptCryptography.ppt
Cryptography.ppt
kusum sharma
 
Cryptography and network security
Cryptography and network securityCryptography and network security
Cryptography and network securitypatisa
 
Network Security and Cryptography
Network Security and CryptographyNetwork Security and Cryptography
Network Security and Cryptography
Adam Reagan
 

Viewers also liked (16)

Introductory Lecture on Cryptography and Information Security
Introductory Lecture on Cryptography and Information SecurityIntroductory Lecture on Cryptography and Information Security
Introductory Lecture on Cryptography and Information Security
 
Class 16
Class 16Class 16
Class 16
 
Public Key Cryptography
Public Key CryptographyPublic Key Cryptography
Public Key Cryptography
 
Computer Security Lecture 4: Block Ciphers and the Data Encryption Standard
Computer Security Lecture 4: Block Ciphers and the Data Encryption StandardComputer Security Lecture 4: Block Ciphers and the Data Encryption Standard
Computer Security Lecture 4: Block Ciphers and the Data Encryption Standard
 
A Tutorial on Linear and Differential Cryptanalysis by Howard M. Heys
A Tutorial on Linear and Differential Cryptanalysis by Howard M. HeysA Tutorial on Linear and Differential Cryptanalysis by Howard M. Heys
A Tutorial on Linear and Differential Cryptanalysis by Howard M. Heys
 
Data encryption standard
Data encryption standardData encryption standard
Data encryption standard
 
Public Key Cryptography and RSA algorithm
Public Key Cryptography and RSA algorithmPublic Key Cryptography and RSA algorithm
Public Key Cryptography and RSA algorithm
 
DES
DESDES
DES
 
Public Key Cryptography
Public Key CryptographyPublic Key Cryptography
Public Key Cryptography
 
PUBLIC KEY ENCRYPTION
PUBLIC KEY ENCRYPTIONPUBLIC KEY ENCRYPTION
PUBLIC KEY ENCRYPTION
 
Data encryption, Description, DES
Data encryption, Description, DESData encryption, Description, DES
Data encryption, Description, DES
 
Cryptography
CryptographyCryptography
Cryptography
 
Cryptography
CryptographyCryptography
Cryptography
 
Cryptography.ppt
Cryptography.pptCryptography.ppt
Cryptography.ppt
 
Cryptography and network security
Cryptography and network securityCryptography and network security
Cryptography and network security
 
Network Security and Cryptography
Network Security and CryptographyNetwork Security and Cryptography
Network Security and Cryptography
 

Similar to 6.hash mac

Cryptography Key Management.pptx
Cryptography Key Management.pptxCryptography Key Management.pptx
Cryptography Key Management.pptx
SurendraBasnet6
 
crypto1.ppt
crypto1.pptcrypto1.ppt
crypto1.ppt
tommychauhan
 
needed.ppt
needed.pptneeded.ppt
needed.ppt
faizalkhan673954
 
introduction to cryptography (basics of it)
introduction to cryptography (basics of it)introduction to cryptography (basics of it)
introduction to cryptography (basics of it)
neonaveen
 
crypto.ppt
crypto.pptcrypto.ppt
crypto.ppt
Ganesh Chavan
 
introduction to cryptography
introduction to cryptographyintroduction to cryptography
introduction to cryptography
Priyamvada Singh
 
Chapter 15 - Security
Chapter 15 - SecurityChapter 15 - Security
Chapter 15 - Security
Wayne Jones Jnr
 
Introduction to security_and_crypto
Introduction to security_and_cryptoIntroduction to security_and_crypto
Introduction to security_and_crypto
Harry Potter
 
Introduction to security_and_crypto
Introduction to security_and_cryptoIntroduction to security_and_crypto
Introduction to security_and_crypto
James Wong
 
Introduction to security_and_crypto
Introduction to security_and_cryptoIntroduction to security_and_crypto
Introduction to security_and_crypto
Young Alista
 
Introduction to security_and_crypto
Introduction to security_and_cryptoIntroduction to security_and_crypto
Introduction to security_and_crypto
David Hoen
 
Introduction to security_and_crypto
Introduction to security_and_cryptoIntroduction to security_and_crypto
Introduction to security_and_crypto
Tony Nguyen
 
Introduction to security_and_crypto
Introduction to security_and_cryptoIntroduction to security_and_crypto
Introduction to security_and_crypto
Luis Goldster
 
Introduction to security_and_crypto
Introduction to security_and_cryptoIntroduction to security_and_crypto
Introduction to security_and_crypto
Fraboni Ec
 
Cryptography for Smalltalkers 2 - ESUG 2006
Cryptography for Smalltalkers 2 - ESUG 2006Cryptography for Smalltalkers 2 - ESUG 2006
Cryptography for Smalltalkers 2 - ESUG 2006
Martin Kobetic
 
Digital Signatures: Reassessing security of randomizable signatures
Digital Signatures: Reassessing security of randomizable signaturesDigital Signatures: Reassessing security of randomizable signatures
Digital Signatures: Reassessing security of randomizable signatures
Priyanka Aash
 
Hashfunction
HashfunctionHashfunction
Hashfunction
Tony Nguyen
 
Hashfunction
HashfunctionHashfunction
Hashfunction
Fraboni Ec
 

Similar to 6.hash mac (20)

Cryptography Key Management.pptx
Cryptography Key Management.pptxCryptography Key Management.pptx
Cryptography Key Management.pptx
 
crypto1.ppt
crypto1.pptcrypto1.ppt
crypto1.ppt
 
needed.ppt
needed.pptneeded.ppt
needed.ppt
 
introduction to cryptography (basics of it)
introduction to cryptography (basics of it)introduction to cryptography (basics of it)
introduction to cryptography (basics of it)
 
crypto.ppt
crypto.pptcrypto.ppt
crypto.ppt
 
introduction to cryptography
introduction to cryptographyintroduction to cryptography
introduction to cryptography
 
Chapter 15 - Security
Chapter 15 - SecurityChapter 15 - Security
Chapter 15 - Security
 
Introduction to security_and_crypto
Introduction to security_and_cryptoIntroduction to security_and_crypto
Introduction to security_and_crypto
 
Introduction to security_and_crypto
Introduction to security_and_cryptoIntroduction to security_and_crypto
Introduction to security_and_crypto
 
Introduction to security_and_crypto
Introduction to security_and_cryptoIntroduction to security_and_crypto
Introduction to security_and_crypto
 
Introduction to security_and_crypto
Introduction to security_and_cryptoIntroduction to security_and_crypto
Introduction to security_and_crypto
 
Introduction to security_and_crypto
Introduction to security_and_cryptoIntroduction to security_and_crypto
Introduction to security_and_crypto
 
Introduction to security_and_crypto
Introduction to security_and_cryptoIntroduction to security_and_crypto
Introduction to security_and_crypto
 
Introduction to security_and_crypto
Introduction to security_and_cryptoIntroduction to security_and_crypto
Introduction to security_and_crypto
 
Cryptography for Smalltalkers 2 - ESUG 2006
Cryptography for Smalltalkers 2 - ESUG 2006Cryptography for Smalltalkers 2 - ESUG 2006
Cryptography for Smalltalkers 2 - ESUG 2006
 
Digital Signatures: Reassessing security of randomizable signatures
Digital Signatures: Reassessing security of randomizable signaturesDigital Signatures: Reassessing security of randomizable signatures
Digital Signatures: Reassessing security of randomizable signatures
 
Hashfunction
HashfunctionHashfunction
Hashfunction
 
Hashfunction
HashfunctionHashfunction
Hashfunction
 
Hashfunction
HashfunctionHashfunction
Hashfunction
 
Hashfunction
HashfunctionHashfunction
Hashfunction
 

Recently uploaded

AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
R&R Consult
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
Jayaprasanna4
 
Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
SupreethSP4
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
Robbie Edward Sayers
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
seandesed
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
BrazilAccount1
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
ydteq
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
VENKATESHvenky89705
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation & Control
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
BrazilAccount1
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
manasideore6
 

Recently uploaded (20)

AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
 
Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
 

6.hash mac

  • 1. Cryptographic Hash Functions Message Authentication Digital Signatures
  • 2. Abstract We will discuss • Cryptographic hash functions • Message authentication codes – HMAC and CBC-MAC • Digital signatures 2
  • 3. Encryption/Decryption • Provides message confidentiality. • Does it provide message authentication? 3
  • 4. Bob receives a message from Alice, he wants to know (Data origin authentication) whether the message was really sent by Alice; (Data integrity) whether th Message Authentication m• g g message authentication code e message has been modified. Solutions: Alice attaches a (MAC) to the message. Or she attach digital signatures a to the message.e • g g 4
  • 5. A hash function maps from a domain to a smaller range, typically many-to-one. Properties required of a hash function depend on its applications. Applications: Fast loo Hash function • • • g kup (hash tables) Error detection/correction cryptographic haCryp sh ftography unctions: Others g g g 5
  • 6. * * : , | | | |. For example, :{0,1} {0,1} :{0,1} :{0,1} {0,1} , . If Hash functi is ons: Cryptographic hash function n n k l h X Y X Y h h Z h k l X • → > • → → → > • ( ) finite, is also called a compression function. A classical application: users/clients passwords are stored in a file not as username, password , but as username, h h • ( ) using some cryptographic hash fu (password nctio ) n .h 6
  • 7. Pre-image: if ( ) , is a pre-image of . Each hash value typically has multiple pre-images. Collision: a pair of ( , ), , s.t. ( ) ( ). A hash function is said t Security requirements h m y m y m m m m h m h m • = • ′ ′ ′• ≠ = o be: if it is computationally infeasible to find a pre-image of a hash value. if it is computationally in Pre-image resistant C feasible to find a col ollision re lision sistant . A hash fun • • • cryptographic hash functioction is a if it is collision resista n nt. 7
  • 8. 8 • Collision-resistant hash functions can be built from collision-resistant compression functions using Merkle-Damgard construction.
  • 9. * * hash compression Construct a cryptographic function :{0,1} {0,1} from a function :{0,1} {0,1} . 1. For {0,1} , add to so that | '| ispadding Merkle-Damgard construction n n b n h f m m m + • → → ∈ 1 2 0 1 a multiple of . Let padded ' , each of length . (padding = 10...0 | |, where | | is the length of ) 3. Let IV and ( ) for 1 . 4. The hash value ( k i i i i b m m m m m b m m m v v v m i k h f − = = = ≤ ≤ K P ) . If is collision-resistant, then is colliTheor sion-resistant.em. km v f h =
  • 10. Merkle-Damgard Construction Compression function :{0,1} {0,1}n b n f + → m1 m2 m3 mk f f fIV v0 v1 v2 vk … f h(m)
  • 11. 64 an NIST standard. using Merkle-Damgard construction. input message is divided into blocks with padding. padding = 10...0 , where {0,1} indicates | | in The Secure Hash Algorithm (SHA-1) m m • • • • ∈l l 64 0 15 0 4 binary. thus, message length limited to | | 2 1. block = 512 bits = 16 words = . IV a constant of 160 bits = 5 words = . resulting hash value: 160 bits. underlying compre m W W H H • ≤ − • • = • • KP P KP P 160 512 160 ssion function :{0,1} {0,1} , a series (80 rounds) of , , , , +, and Rotate on words ' & 's.i i f W s H + → ∧ ∨ ⊕ ¬
  • 12. { }1 2 An attack is to produce a collision. Birthday attack: randomly generate a set of messages , , , , hoping to produce a collision. 160 is big enough to resist birthda Is SHA-1 secure? km m m n • • • = K y attacks . There is no mathematical proof for its collision resistancy. In 2004, a collision for a "58 rounds" SHA-1 was produced. (The compression function of SHA-1 has 80 roun for n ds.) ow N • • • ewer SHA's have been included in the standard: SHA-256, SHA-384, SHA-512. 12
  • 13. In a group of people, what is the probability that at least two people have Having the same birthday is a the same bi collision? Birthday problem: Birthday rthday? 1 2 withparadox: k p • • ≥ g as small as 23. Consider a hash function :{0,1} {0,1} . If we randomly generate messages, the probability of having a collision depends on . To resist birthday attack, we choose to n k h k n n ∗ • → • • be sufficiently large that it will take an infeasibly large to have a non-negligible probability of collision. k
  • 14. modification detection codes (MDC) Storing passwords Used to produce ( ), called an MDC, is stored in a secure place; if is modified, we Applications of cryptographic hash functions h m m • • g g can detect it; protecting the integrity of . We will see some other applicati son . m • g 14
  • 15. Bob receives a message from Alice, he wants to know (Data origin authentication) whether the message was really sent by Alice; (Data integrity) whether th Message Authentication m• g g message authentication code e message has been modified. Solutions: Alice attaches a (MAC) to the message. Or she attach digital signatures a to the message.e • g g 15
  • 16. Message authentication protocol: 1. Alice and Bob share a secret key . 2. Alice sends MAC ( ) to Bob. 3. Bob authenticates the received MAC by checking if MAC MAC ( )? MAC k k k m m m m • ′ ′ ′ ′= • P P MAC ( ) is called a . Security requirement: infeasible to produce a valid pair ( , MA message auth C ( )) w entication ithout knowing the key e . c dok k m x x k • 16
  • 17. A common way to construct a MAC is to incorporate a secret key into a fixed hash function (e.g. SH Insecure: A-1). MAC ( ) ( ) ( ) wit IVh Constructing MAC from a hash k k k h m h m h m k • • = = =g g MAC ( ) ( ) ( )k km h m h k m= = P 17
  • 18. m = m1 m2 m3 ms f f fIV … f h(m) k X X hk(m) fhk(m) hk(m||ms+1) ms+1 1 ( ) ( ) with IV . (For simplicity, without Insecure: Easy to forge: ( , ( )), padd where ing) k s k m M h m AC m h m m m k m + • ′ ′ = = • ′ = P
  • 19. ( )2 1 1 2 A FIPS standard for constructing MAC from a hash function . Conceptually, HMAC ( ) ( ) where and are two keys generated from . Various HMAC (Hash-based MAC) k m k k m k h k k h h • = • P P ( ) hash functions (e.g., SHA-1, MD5) may be used for . If we use , then HMAC is as follows: HMAC ( ) ( ) where is padded with 0's to 512 SHA-1 SHA-1 SHA bits 1-k h m k opad k ipad m k • = ⊕ ⊕ g P P 3636 36 (x036 repeated 64 times) 5c5c 5c (x05c repeated 64 times) ipad opad = = L g g L
  • 20. A FIPS and ISO standard. One of the most popular MACs in use. Use a block cipher in CBC mode with a fixed, public IV. Called DES CBC-MAC if the block cipher is DES. Let :{0,1} {0,1 CBC-MAC n E • • • • • → 1 2 0 1 } be a block cipher. CBC-MAC( , ) , where | | . IV (typically 0 ) for 1 to do ( ) return( ) n l i n i k i i l m k m m m m m n c i l c E c m c − • = = ¬ ¬ ¬ ⊕ KP P P 20
  • 22. A refined version of CBC-MAC. Adopted by NIST for use with AES and 3DES. Use two keys: , (assuming is a multiple of ). Let :{0,1} {0,1} be a block cipher. CM CMAC (Cipher-based MAC) n n k k m n E • • ′• • → • 1 2 0 1 1 AC( , ) , where | | . IV (typically 0 ) for 1 to 1 do ( ) ( ) return( ) l i n i k i i l k l l l m k k m m m m m n c i l c E c m c E c m c − − = = ¬ ¬ − ′⊕ ¬ ⊕ ¬ ⊕ KP P P 22
  • 23. RSA can be used for digital signatures. A digital signature is the same as a MAC except that the tag (signature) is produced using a public-key cryptosystem. Digital Digital Signatures • • • signatures are used to provide message authentication an non-repudiatd ion. Message m MACk(m) Message m Sigpr(m)
  • 24. Digital signature protocol: 1. Bob has a key pair ( , ). 2. Bob sends Sig ( ) to Alice. 3. Alice verifies the received by checking if Verify ( ). Sig ( ) is calle pr pu pr pr pu m m m s s m m • ′ ′ ′ ′= • P P d a . Security requirement: infeasible to forge a valid pair ( , S signatu ig ( )) without knowing re for .prm m pr m •
  • 25. MCE D PUBob PRBob Alice Bob M MSE D PUBob PRBob Alice Bob Verify Sign Encryption (using RSA): Digital signature (using RSA-1 ): E(S) =M?
  • 26. * are generated as for RSA encryption: Public key: . Private key: . a message : ( ) mod . That is, Keys Signin ( , ) ( , ) g RSA Signature d n PR PU n e PR n d m Z D m m nσ σ ∈• = = = • = 1 RSA ( ). a signature ( , ) : check if ( ) mod , or RSA( ). Only the key's owner can sign, Ver but anybody can ver ify ify. ing e PU m m m E n m σ σ σ σ − = = • = = •
  • 27. * RSA 1. Every message is a valid signature for its ciphertext : RSA( ). Encryption (using Bob's public key): Existential forgeries Sig : Security of RSA Signature nm Z c m m c ∈ =  • → 1 RSA 1 2 1 2 1 2 1 2 n ( using Bob's private key): 2. If Bob signed and , then the signature for can be easily forged if hash a : ( ) ( ) ( ). Counterme nd siasure gn: : m c m m m m m m m mσ σ σ σ − • ¬  = Sign ( ( )), using some collision resistant hash function . PR h m h =
  • 28. Does hash-then-sign make RSA signature secure against chosen-message attacks? Question: Answer: random oracleYes, is a i.e., is a all if full- random or d a , cle mapping {0 omainh h • • g * ,1} ( is the full domain of RSA) n n Z Z → g
  • 29. { } 160 In practice, is full-domain. For instance, the range of SHA-1 is {0,1} , while 0,1,...,2 1 , wi Problem with full- th 1024. domain hash: Desired: a sec no ure signature scheme t n n h Z n • = − ≥ • that does not require a full-domain hash.
  • 30. * pad Hash function :{0,1} {0,1} (not full domain). | |. (E.g., SHA-1, 160; RSA, 1024.) Idea: Probabilistic signature scheme l Nh Z l n N l n m m r → ⊂ < = = = • • → P * hash expand 1 si 1 gn 1 {0,1} ( ) {0,1} ( ) {0,1} RSA ( ) ( )0n l l nk r w h m r y w G w yσ − − − − − ∈ → = ∈ → = ⊕ ∈ → = PP P 1 where {0,1} :{0,1} {0,1} (pseudorandom generator) N k l n l Z r G − − ∈ ∈ →
  • 31. * 11 2 2 1 a message {0,1} : 1. choose a random {0,1} ; compute ( ); 2. compute ;( ) ( ) // // 3. The signatu Signing re is RSA ( ). k m r w h m r G G Gw y y w r G G w σ − ∈ ∈ = = = = • ⊕P P P P
  • 32. PSS is secure against chosen-message attacks in the random oracle model (i.e., if and are random oracles). PSS is adopted in PKCS #1 v.2.1. Hash functions such as SHA-1 Remarks are used f h G • • • 1 2 or and . For instance, let 1024, and 160 let = SHA-1 ( , )( ) ( ) ( 0) ( 1) ( 2), ... h G n l k h G G w G w h w h w h w = = = = = • P P P PP