Chapter4

Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

Advanced cryptography

Master 1 Cyber Security

Dr. Yasmine Harbi


yasmine.harbi@univ-setif.dz
Chapter 4
HASH FUNCTIONS

2
Outline
• Secure Hash Algorithms
• Message Authentication Code

3
Review of symmetric cryptography
• Confidentiality:
– Block ciphers using encryption modes.
– Stream ciphers using pseudo-random number
generators.
• Limitations:
– Secure channel for key distribution.
– Many keys for n users.
• Solution: public key cryptography.

4
Motivation

• Alice wants to send a secret message (m) to Bob using his public key.
• Oscar intercepts and replaces the message with his own data (m*).
• Bob encrypts the response with Oscar’s public key.
• Oscar decrypts the message and gets the secret data!
• Confidentiality is not enough!

5
Hash function
• Takes as input a variable-length message and produces a
fixed-length hash value (a.k.a message digest) based on a
compression function.
• It is defined by the following expression:
h : {0, 1}∗ → {0, 1}n
• For example, hello world →
b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9
• It has the following properties:
– Computation of the hash value should be easy
– Inversion of the hash value should be difficult (preimage
resistant)
– Collision-resistant

6
Avalanche effect
• It is an important property for the design of
cryptographic algorithms, typically block
ciphers and hash functions.
• Refers to changing one bit of the plaintext or
the key should change half of the bits in the
ciphertext.
• A good cryptographic algorithm should satisfy
an avalanche effect > 50%

7
Applications
• Message integrity verification.
• Password verification (database).
• Message authentication code (MAC).
• Digital signatures.
• Pseudo-random number generators (PRNG).
• Blockchain (proof of work).

8
Common examples
• MD-x family:
– MD4 : 1990, Broken
– MD5 : 1992, Broken
• SHA-x family:
– SHA-0 , 1993, Broken
– SHA-1 , 1995, Theoretically Broken in 2005
– SHA-2 , 2002
– SHA-3, 2015, still have to test

9
Merkle-Damgard construction
• How do we build a hash function?
• Maps a compression function into a
cryptographic hash function by:
– Applying padding to the original message.
– Dividing the padded message to fixed size blocks.
– Iterating a compression function over each block
starting from an initial value.

10
Compression function

• A compression function is a one-way function


that transforms two fixed-length inputs into a
single fixed-length output.
• Merkle-Damgard construction is used in the
design of many popular hash algorithms such as
MD5, SHA-1, and SHA-2.
11
Secure Hash Algorithms

Algorithm Block size Output size Rounds


SHA-1 512 160 80
SHA-2 512, 1024 224, 256, 384, 512 64, 80
SHA-3 1152, 1088, 832, 576 224, 256, 384, 512 24
(a.k.a Keccak)

12
SHA-1

13
Message authentication code
• It is a keyed hash function that takes a
variable-length message and a fixed-size
secret key and produces a fixed message
digest.
• It can be defined by the following expression:
y = h(m, k)
• It aims to ensure both the source of the
message and its integrity.

14
15

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy