one-way encryption and message authentication · introduction definitions definition a hash...

73
One-Way Encryption and Message Authentication Cryptographic Hash Functions Johannes Mittmann [email protected] Zentrum Mathematik Technische Universit¨ at M¨ unchen (TUM) 3 rd Joint Advanced Student School (JASS) St. Petersburg, March 30 – April 9, 2005 Course 1: Algorithms for IT Security Johannes Mittmann (TU M¨ unchen) One-Way Encryption JASS 2005 – IT Security 1 / 35

Upload: others

Post on 03-Jun-2020

11 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

One-Way Encryption and Message AuthenticationCryptographic Hash Functions

Johannes [email protected]

Zentrum MathematikTechnische Universitat Munchen (TUM)

3rd Joint Advanced Student School (JASS)St. Petersburg, March 30 – April 9, 2005

Course 1: Algorithms for IT Security

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 1 / 35

Page 2: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Outline

1 Introduction

2 Security of Hash FunctionsGeneric Attacks in the Random Oracle ModelComparison of Security Criteria

3 Iterated Hash FunctionsThe Merkle-Damgard ConstructionThe Secure Hash Algorithm (SHA-1)

4 Message Authentication Codes (MACs)Nested MACs, HMAC and CBC-MACUnconditionally Secure MACs

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 2 / 35

Page 3: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Introduction

Hash Functions

h : {0, 1}∗ → {0, 1}m hash function

constructs short ”fingerprint” of an arbitrarily long message x

computation of h(x) should be easy

small change of x should change h(x) completely

it should be hard to find

(second) preimagescollisions

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 3 / 35

Page 4: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Introduction

Applications of Hash Functions

verification of data integrity

authentication of data origin

optimization of digital signature schemes

digital timestamping schemes

hashcash

password protection

pseudo-random numbers generation

. . .

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 4 / 35

Page 5: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Introduction

Definitions

Definition

A hash family is a four-tuple (X ,Y,K,H), where:

1 X is a set of possible messages

2 Y is a finite set of possible message digests or authentication tags

3 K, the keyspace, is a finite set of possible keys

4 for each K ∈ K, there is a hash function hK ∈ H, hK : X → Y.

X finite: compression function

(x , y) ∈ X × Y is valid pair under the key K ⇐⇒ hK (x) = y

(N,M)-hash family, where N = |X | ,M = |Y|

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 5 / 35

Page 6: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Introduction

Definitions

Definition

A hash family is a four-tuple (X ,Y,K,H), where:

1 X is a set of possible messages

2 Y is a finite set of possible message digests or authentication tags

3 K, the keyspace, is a finite set of possible keys

4 for each K ∈ K, there is a hash function hK ∈ H, hK : X → Y.

X finite: compression function

(x , y) ∈ X × Y is valid pair under the key K ⇐⇒ hK (x) = y

(N,M)-hash family, where N = |X | ,M = |Y|

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 5 / 35

Page 7: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Security of Hash Functions

Cryptographic Properties

Preimage Resistance (One-Wayness)

Instance: hash function h : X → Y and y ∈ Y.

Find: x ∈ X such that h(x) = y .

Second Preimage Resistance

Instance: hash function h : X → Y and x ∈ X .

Find: x ′ ∈ X such that x ′ 6= x and h(x ′) = h(x).

Collision Resistance

Instance: hash function h : X → Y.

Find: x , x ′ ∈ X such that x ′ 6= x and h(x ′) = h(x).

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 6 / 35

Page 8: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Security of Hash Functions

Cryptographic Properties

Preimage Resistance (One-Wayness)

Instance: hash function h : X → Y and y ∈ Y.

Find: x ∈ X such that h(x) = y .

Second Preimage Resistance

Instance: hash function h : X → Y and x ∈ X .

Find: x ′ ∈ X such that x ′ 6= x and h(x ′) = h(x).

Collision Resistance

Instance: hash function h : X → Y.

Find: x , x ′ ∈ X such that x ′ 6= x and h(x ′) = h(x).

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 6 / 35

Page 9: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Security of Hash Functions

Cryptographic Properties

Preimage Resistance (One-Wayness)

Instance: hash function h : X → Y and y ∈ Y.

Find: x ∈ X such that h(x) = y .

Second Preimage Resistance

Instance: hash function h : X → Y and x ∈ X .

Find: x ′ ∈ X such that x ′ 6= x and h(x ′) = h(x).

Collision Resistance

Instance: hash function h : X → Y.

Find: x , x ′ ∈ X such that x ′ 6= x and h(x ′) = h(x).

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 6 / 35

Page 10: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Security of Hash Functions Generic Attacks in the Random Oracle Model

The Random Oracle Model

mathematical model of an ”ideal” hash function

hash function h : X → Y is chosen randomly from YX

only oracle access

(ε, q)-algorithm: Las Vegas algorithm with average-case successprobability ε and at most q oracle queries

Theorem (independence property)

Let h ∈ YX be chosen at random, and let X0 ⊆ X . Suppose that thevalues h(x) have been determined iff x ∈ X0. Then

Pr [h(x) = y ] =1

M∀x ∈ X \ X0 ∀y ∈ Y.

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 7 / 35

Page 11: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Security of Hash Functions Generic Attacks in the Random Oracle Model

The Random Oracle Model

mathematical model of an ”ideal” hash function

hash function h : X → Y is chosen randomly from YX

only oracle access

(ε, q)-algorithm: Las Vegas algorithm with average-case successprobability ε and at most q oracle queries

Theorem (independence property)

Let h ∈ YX be chosen at random, and let X0 ⊆ X . Suppose that thevalues h(x) have been determined iff x ∈ X0. Then

Pr [h(x) = y ] =1

M∀x ∈ X \ X0 ∀y ∈ Y.

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 7 / 35

Page 12: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Security of Hash Functions Generic Attacks in the Random Oracle Model

Algorithm for Preimage

Algorithm: FindPreimage(h, y , q)

1: choose X0 ⊆ X , |X0| = q2: for all x ∈ X0 do3: if h(x) = y then return x4: end for5: return failure

Theorem

For any X0 ⊆ X with |X0| = q, the average-case success probability ofFindPreimage(h, y , q) is

ε = 1−(

1− 1

M

)q

.

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 8 / 35

Page 13: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Security of Hash Functions Generic Attacks in the Random Oracle Model

Algorithm for Preimage

Algorithm: FindPreimage(h, y , q)

1: choose X0 ⊆ X , |X0| = q2: for all x ∈ X0 do3: if h(x) = y then return x4: end for5: return failure

Theorem

For any X0 ⊆ X with |X0| = q, the average-case success probability ofFindPreimage(h, y , q) is

ε = 1−(

1− 1

M

)q

.

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 8 / 35

Page 14: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Security of Hash Functions Generic Attacks in the Random Oracle Model

Algorithm for Second Preimage

Algorithm: FindSecondPreimage(h, x , q)

1: y ← h(x)2: choose X0 ⊆ X \ {x}, |X0| = q − 13: for all x0 ∈ X0 do4: if h(x0) = y then return x0

5: end for6: return failure

Theorem

For any X0 ⊆ X \ {x} with |X0| = q − 1, the success probability ofFindSecondPreimage(h, x , q) is

ε = 1−(

1− 1

M

)q−1

.

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 9 / 35

Page 15: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Security of Hash Functions Generic Attacks in the Random Oracle Model

Algorithm for Second Preimage

Algorithm: FindSecondPreimage(h, x , q)

1: y ← h(x)2: choose X0 ⊆ X \ {x}, |X0| = q − 13: for all x0 ∈ X0 do4: if h(x0) = y then return x0

5: end for6: return failure

Theorem

For any X0 ⊆ X \ {x} with |X0| = q − 1, the success probability ofFindSecondPreimage(h, x , q) is

ε = 1−(

1− 1

M

)q−1

.

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 9 / 35

Page 16: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Security of Hash Functions Generic Attacks in the Random Oracle Model

Random (Second) Preimage Attack

1− ε =

(1− 1

M

)q

=

q∑i=0

(q

i

)(− 1

M

)i

≈ 1− q

M.

q ≈ εM.

=⇒ (ε,O(M))-algorithm

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 10 / 35

Page 17: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Security of Hash Functions Generic Attacks in the Random Oracle Model

Random (Second) Preimage Attack

1− ε =

(1− 1

M

)q

=

q∑i=0

(q

i

)(− 1

M

)i

≈ 1− q

M.

q ≈ εM.

=⇒ (ε,O(M))-algorithm

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 10 / 35

Page 18: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Security of Hash Functions Generic Attacks in the Random Oracle Model

Random (Second) Preimage Attack

1− ε =

(1− 1

M

)q

=

q∑i=0

(q

i

)(− 1

M

)i

≈ 1− q

M.

q ≈ εM.

=⇒ (ε,O(M))-algorithm

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 10 / 35

Page 19: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Security of Hash Functions Generic Attacks in the Random Oracle Model

Algorithm for Collision

Algorithm: FindCollision(h, q)

1: choose X0 ⊆ X , |X0| = q2: for all x ∈ X0 do yx ← h(x)3: if yx = yx ′ for some x ′ 6= x then return (x , x ′)4: else return failure

Theorem

For any X0 ⊆ X with |X0| = q, the success probability ofCollision(h, q) is

ε = 1−q−1∏i=1

(1− i

M

).

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 11 / 35

Page 20: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Security of Hash Functions Generic Attacks in the Random Oracle Model

Algorithm for Collision

Algorithm: FindCollision(h, q)

1: choose X0 ⊆ X , |X0| = q2: for all x ∈ X0 do yx ← h(x)3: if yx = yx ′ for some x ′ 6= x then return (x , x ′)4: else return failure

Theorem

For any X0 ⊆ X with |X0| = q, the success probability ofCollision(h, q) is

ε = 1−q−1∏i=1

(1− i

M

).

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 11 / 35

Page 21: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Security of Hash Functions Generic Attacks in the Random Oracle Model

Birthday (Collision) Attack

1− ε =

q−1∏i=1

(1− i

M

)≈

q−1∏i=1

exp

(− i

M

)= exp

(−

q−1∑i=1

i

M

)

= exp

(−q(q − 1)

2M

)≈ exp

(− q2

2M

).

q ≈√

2M log1

1− ε.

=⇒ (ε,O(√

M))-algorithm

Example (Birthday Paradox)

ε = 0.5, M = 365 =⇒ q ≈ 1.17√

M ≈ 22.3.

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 12 / 35

Page 22: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Security of Hash Functions Generic Attacks in the Random Oracle Model

Birthday (Collision) Attack

1− ε =

q−1∏i=1

(1− i

M

)≈

q−1∏i=1

exp

(− i

M

)= exp

(−

q−1∑i=1

i

M

)

= exp

(−q(q − 1)

2M

)≈ exp

(− q2

2M

).

q ≈√

2M log1

1− ε.

=⇒ (ε,O(√

M))-algorithm

Example (Birthday Paradox)

ε = 0.5, M = 365 =⇒ q ≈ 1.17√

M ≈ 22.3.

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 12 / 35

Page 23: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Security of Hash Functions Generic Attacks in the Random Oracle Model

Birthday (Collision) Attack

1− ε =

q−1∏i=1

(1− i

M

)≈

q−1∏i=1

exp

(− i

M

)= exp

(−

q−1∑i=1

i

M

)

= exp

(−q(q − 1)

2M

)≈ exp

(− q2

2M

).

q ≈√

2M log1

1− ε.

=⇒ (ε,O(√

M))-algorithm

Example (Birthday Paradox)

ε = 0.5, M = 365 =⇒ q ≈ 1.17√

M ≈ 22.3.

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 12 / 35

Page 24: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Security of Hash Functions Generic Attacks in the Random Oracle Model

Birthday (Collision) Attack

1− ε =

q−1∏i=1

(1− i

M

)≈

q−1∏i=1

exp

(− i

M

)= exp

(−

q−1∑i=1

i

M

)

= exp

(−q(q − 1)

2M

)≈ exp

(− q2

2M

).

q ≈√

2M log1

1− ε.

=⇒ (ε,O(√

M))-algorithm

Example (Birthday Paradox)

ε = 0.5, M = 365 =⇒ q ≈ 1.17√

M ≈ 22.3.

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 12 / 35

Page 25: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Security of Hash Functions Generic Attacks in the Random Oracle Model

Generic Attacks on Cryptographic Hash Functions

attack algorithm

random (second) preimage (ε,O(M))

birthday (collision) (ε,O(√

M))

attacks are optimal in the random oracle model

minimum acceptable size of a message digest: 128 bits

160-bit message digest (or larger) recommended

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 13 / 35

Page 26: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Security of Hash Functions Generic Attacks in the Random Oracle Model

Generic Attacks on Cryptographic Hash Functions

attack algorithm

random (second) preimage (ε,O(M))

birthday (collision) (ε,O(√

M))

attacks are optimal in the random oracle model

minimum acceptable size of a message digest: 128 bits

160-bit message digest (or larger) recommended

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 13 / 35

Page 27: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Security of Hash Functions Comparison of Security Criteria

Reduce Collision to Second Preimage

Algorithm: CollisionTo2ndPreimage(h)

1: choose x ∈ X uniformly at random2: if Oracle2ndPreimage(h, x) = x ′ and x ′ 6= x and h(x ′) = h(x)

then return (x , x ′)3: else return failure

Oracle2ndPreimage is (ε, q)-algorithm for Second Preimage =⇒CollisionTo2ndPreimage is (ε, q + 2)-algorithm for Collision

collision resistance =⇒ second preimage resistance

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 14 / 35

Page 28: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Security of Hash Functions Comparison of Security Criteria

Reduce Collision to Second Preimage

Algorithm: CollisionTo2ndPreimage(h)

1: choose x ∈ X uniformly at random2: if Oracle2ndPreimage(h, x) = x ′ and x ′ 6= x and h(x ′) = h(x)

then return (x , x ′)3: else return failure

Oracle2ndPreimage is (ε, q)-algorithm for Second Preimage =⇒CollisionTo2ndPreimage is (ε, q + 2)-algorithm for Collision

collision resistance =⇒ second preimage resistance

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 14 / 35

Page 29: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Security of Hash Functions Comparison of Security Criteria

Reduce Collision to Preimage

Algorithm: CollisionToPreimage(h)

Require: OraclePreimage is (1, q)-algorithm1: choose x ∈ X uniformly at random2: y ← h(x)3: if OraclePreimage(h, y) = x ′ and x ′ 6= x then return (x , x ′)4: else return failure

Theorem

Let h : X → Y be a compression function, where |X | > 2 |Y|. SupposeOraclePreimage is a (1, q)-algorithm that solves Preimage for h. ThenCollisionToPreimage is a (1/2, q + 1)-algorithm for Collision, for thefixed compression function h.

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 15 / 35

Page 30: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Security of Hash Functions Comparison of Security Criteria

Reduce Collision to Preimage

Algorithm: CollisionToPreimage(h)

Require: OraclePreimage is (1, q)-algorithm1: choose x ∈ X uniformly at random2: y ← h(x)3: if OraclePreimage(h, y) = x ′ and x ′ 6= x then return (x , x ′)4: else return failure

Theorem

Let h : X → Y be a compression function, where |X | > 2 |Y|. SupposeOraclePreimage is a (1, q)-algorithm that solves Preimage for h. ThenCollisionToPreimage is a (1/2, q + 1)-algorithm for Collision, for thefixed compression function h.

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 15 / 35

Page 31: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Security of Hash Functions Comparison of Security Criteria

Proof.

x ∼ x ′ ⇐⇒ h(x) = h(x ′) is equivalence relation on X

C := X/∼, so |C| = |Y|for x ∈ X the probability of success is (|[x ]| − 1)/ |[x ]|

Pr[success] =1

|X |∑x∈X

|[x ]| − 1

|[x ]|=

1

|X |∑C∈C

∑x∈C

|C | − 1

|C |

=1

|X |∑C∈C

(|C | − 1) =|X | − |Y||X |

>|X | − |X | /2

|X |=

1

2.

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 16 / 35

Page 32: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Security of Hash Functions Comparison of Security Criteria

Proof.

x ∼ x ′ ⇐⇒ h(x) = h(x ′) is equivalence relation on XC := X/∼, so |C| = |Y|

for x ∈ X the probability of success is (|[x ]| − 1)/ |[x ]|

Pr[success] =1

|X |∑x∈X

|[x ]| − 1

|[x ]|=

1

|X |∑C∈C

∑x∈C

|C | − 1

|C |

=1

|X |∑C∈C

(|C | − 1) =|X | − |Y||X |

>|X | − |X | /2

|X |=

1

2.

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 16 / 35

Page 33: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Security of Hash Functions Comparison of Security Criteria

Proof.

x ∼ x ′ ⇐⇒ h(x) = h(x ′) is equivalence relation on XC := X/∼, so |C| = |Y|for x ∈ X the probability of success is (|[x ]| − 1)/ |[x ]|

Pr[success] =1

|X |∑x∈X

|[x ]| − 1

|[x ]|=

1

|X |∑C∈C

∑x∈C

|C | − 1

|C |

=1

|X |∑C∈C

(|C | − 1) =|X | − |Y||X |

>|X | − |X | /2

|X |=

1

2.

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 16 / 35

Page 34: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Security of Hash Functions Comparison of Security Criteria

Proof.

x ∼ x ′ ⇐⇒ h(x) = h(x ′) is equivalence relation on XC := X/∼, so |C| = |Y|for x ∈ X the probability of success is (|[x ]| − 1)/ |[x ]|

Pr[success] =1

|X |∑x∈X

|[x ]| − 1

|[x ]|=

1

|X |∑C∈C

∑x∈C

|C | − 1

|C |

=1

|X |∑C∈C

(|C | − 1) =|X | − |Y||X |

>|X | − |X | /2

|X |=

1

2.

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 16 / 35

Page 35: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Iterated Hash Functions

Iterated Hash Functions

Compress : {0, 1}m+t → {0, 1}m, t > 1.

1 preprocessinginput string x , |x | > m + t + 1construct

y = y1 ‖ y2 ‖ · · · ‖ yr , |yi | = t

x 7→ y(x) injection

y = x ‖Pad(x) padding function

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 17 / 35

Page 36: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Iterated Hash Functions

Iterated Hash Functions

Compress : {0, 1}m+t → {0, 1}m, t > 1.

1 preprocessinginput string x , |x | > m + t + 1construct

y = y1 ‖ y2 ‖ · · · ‖ yr , |yi | = t

x 7→ y(x) injection

y = x ‖Pad(x) padding function

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 17 / 35

Page 37: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Iterated Hash Functions

Design of Iterated Hash Functions

2 processing

z0 ← IV, |IV| = m

z1 ← Compress(z0 ‖ y1)

...

zr ← Compress(zr−1 ‖ yr )

3 optional output transformationg : {0, 1}m → {0, 1}`

h :∞⋃

i=m+t+1

{0, 1}i → {0, 1}`, h(x) = g(zr ).

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 18 / 35

Page 38: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Iterated Hash Functions

Design of Iterated Hash Functions

2 processing

z0 ← IV, |IV| = m

z1 ← Compress(z0 ‖ y1)

...

zr ← Compress(zr−1 ‖ yr )

3 optional output transformationg : {0, 1}m → {0, 1}`

h :∞⋃

i=m+t+1

{0, 1}i → {0, 1}`, h(x) = g(zr ).

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 18 / 35

Page 39: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Iterated Hash Functions

Design of Iterated Hash Functions

2 processing

z0 ← IV, |IV| = m

z1 ← Compress(z0 ‖ y1)

...

zr ← Compress(zr−1 ‖ yr )

3 optional output transformationg : {0, 1}m → {0, 1}`

h :∞⋃

i=m+t+1

{0, 1}i → {0, 1}`, h(x) = g(zr ).

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 18 / 35

Page 40: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Iterated Hash Functions The Merkle-Damgard Construction

The Merkle-Damgard Construction

Theorem (Merkle-Damgard)

Suppose Compress : {0, 1}m+t → {0, 1}m is a collision resistantcompression function, where t > 1. Then there exists a collision resistanthash function

h :∞⋃

i=m+t+1

{0, 1}i → {0, 1}m.

The number of times Compress is computed in the evaluation of h is atmost

1 +⌈

nt−1

⌉if t > 2,

2n + 2 if t = 1,

where |x | = n.

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 19 / 35

Page 41: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Iterated Hash Functions The Secure Hash Algorithm (SHA-1)

The Secure Hash Algorithm (SHA-1)

Ron Rivest: 128-bit hash function MD4 and strengthened versionMD5

design goals:

(direct) securityspeedsimplicity and compactness

collisions for MD4 (Dobbertin) and compression function of MD5(Boer/Bosselaers)

NIST & NSA: 160-bit hash function SHA-1

Feb. 13, 2005: collisions with < 269 hash operations (Wang/Yin/Yu)

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 20 / 35

Page 42: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Iterated Hash Functions The Secure Hash Algorithm (SHA-1)

The Secure Hash Algorithm (SHA-1)

Ron Rivest: 128-bit hash function MD4 and strengthened versionMD5

design goals:

(direct) securityspeedsimplicity and compactness

collisions for MD4 (Dobbertin) and compression function of MD5(Boer/Bosselaers)

NIST & NSA: 160-bit hash function SHA-1

Feb. 13, 2005: collisions with < 269 hash operations (Wang/Yin/Yu)

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 20 / 35

Page 43: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Iterated Hash Functions The Secure Hash Algorithm (SHA-1)

Padding Scheme

Algorithm: SHA-1-Pad(x)

Require: |x | 6 264 − 1Ensure: |y | = 0 (mod 512)1: d ← (447− |x |) mod 5122: `← the binary representation of |x |, where |`| = 643: return y ← x ‖ 1 ‖ 0d ‖ `

x 1 0 · · · 0 `

Figure: MD-Strengthening

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 21 / 35

Page 44: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Iterated Hash Functions The Secure Hash Algorithm (SHA-1)

SHA-1

ft(B,C ,D) =

BC ∨ (¬B)D,

B ⊕ C ⊕ D,

BC ∨ BD ∨ CD,

B ⊕ C ⊕ D,

Kt =

5A827999, if 0 6 t 6 19,

6ED9EBA1, if 20 6 t 6 39,

8F1BBCDC, if 40 6 t 6 59,

CA62C1D6, if 60 6 t 6 79.

Cryptosystem: SHA-1(x)

1: y ← SHA-1-Pad(x)2: denote y = M1 ‖M2 ‖ · · · ‖Mn, where each Mi is a 512-bit block3: H0 ← 67452301, H1 ← EFCDAB89, H2 ← 98BADCFE4: H3 ← 10325476, H4 ← C3D2E1F0

. . .

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 22 / 35

Page 45: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Iterated Hash Functions The Secure Hash Algorithm (SHA-1)

SHA-1

ft(B,C ,D) =

BC ∨ (¬B)D,

B ⊕ C ⊕ D,

BC ∨ BD ∨ CD,

B ⊕ C ⊕ D,

Kt =

5A827999, if 0 6 t 6 19,

6ED9EBA1, if 20 6 t 6 39,

8F1BBCDC, if 40 6 t 6 59,

CA62C1D6, if 60 6 t 6 79.

Cryptosystem: SHA-1(x)

1: y ← SHA-1-Pad(x)2: denote y = M1 ‖M2 ‖ · · · ‖Mn, where each Mi is a 512-bit block3: H0 ← 67452301, H1 ← EFCDAB89, H2 ← 98BADCFE4: H3 ← 10325476, H4 ← C3D2E1F0

. . .

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 22 / 35

Page 46: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Iterated Hash Functions The Secure Hash Algorithm (SHA-1)

Cryptosystem: SHA-1(x) (continued). . .

1: for i ← 1 to n do2: denote Mi = W0 ‖W1 ‖ · · · ‖W15, where each Wi is a word3: for t ← 16 to 79 do Wt ← (Wt−3⊕Wt−8⊕Wt−14⊕Wt−16)� 14: A← H0, B ← H1, C ← H2

5: D ← H3, E ← H4

6: for t ← 0 to 79 do7: temp ← (A� 5) + ft(B,C ,D) + E + Wt + Kt

8: E ← D, D ← C9: C ← B � 30

10: B ← A, A← temp11: end for12: H0 ← H0 + A, H1 ← H1 + B, H2 ← H2 + C13: H3 ← H3 + D, H4 ← H4 + E14: end for15: return H0 ‖H1 ‖H2 ‖H3 ‖H4

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 23 / 35

Page 47: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Message Authentication Codes (MACs)

Message Authentication Codes (MACs)

”MAC = keyed hash function hK + security properties”

Alice and Bob share secret key K

(x , hK (x)) is transmitted over insecure channel

(Existential) Forgery

Instance: valid pairs (x1, y1), . . . , (xq, yq) under unknown key K .

Find: valid pair (x , y) such that x 6∈ {x1, . . . , xq}.

(ε, q)-forger: forgery with worst-case success probability ε

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 24 / 35

Page 48: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Message Authentication Codes (MACs)

Message Authentication Codes (MACs)

”MAC = keyed hash function hK + security properties”

Alice and Bob share secret key K

(x , hK (x)) is transmitted over insecure channel

(Existential) Forgery

Instance: valid pairs (x1, y1), . . . , (xq, yq) under unknown key K .

Find: valid pair (x , y) such that x 6∈ {x1, . . . , xq}.

(ε, q)-forger: forgery with worst-case success probability ε

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 24 / 35

Page 49: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Message Authentication Codes (MACs)

Example (Iterated hash function hK with IV = K )

Compress : {0, 1}m+t → {0, 1}m. Given: (x , hK (x))

y = x ‖Pad(x), |y | = rt.

x ′ = x ‖Pad(x) ‖w .

y ′ = x ‖Pad(x) ‖w ‖Pad(x ′),∣∣y ′∣∣ = r ′t, r ′ > r .

zr+1 ← Compress(hK (x) ‖ yr+1)

...

zr ′ ← Compress(zr ′−1 ‖ yr ′).

hK (x ′) = zr ′ .=⇒ (1, 1)− forger

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 25 / 35

Page 50: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Message Authentication Codes (MACs)

Example (Iterated hash function hK with IV = K )

Compress : {0, 1}m+t → {0, 1}m. Given: (x , hK (x))

y = x ‖Pad(x), |y | = rt.

x ′ = x ‖Pad(x) ‖w .

y ′ = x ‖Pad(x) ‖w ‖Pad(x ′),∣∣y ′∣∣ = r ′t, r ′ > r .

zr+1 ← Compress(hK (x) ‖ yr+1)

...

zr ′ ← Compress(zr ′−1 ‖ yr ′).

hK (x ′) = zr ′ .=⇒ (1, 1)− forger

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 25 / 35

Page 51: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Message Authentication Codes (MACs)

Example (Iterated hash function hK with IV = K )

Compress : {0, 1}m+t → {0, 1}m. Given: (x , hK (x))

y = x ‖Pad(x), |y | = rt.

x ′ = x ‖Pad(x) ‖w .

y ′ = x ‖Pad(x) ‖w ‖Pad(x ′),∣∣y ′∣∣ = r ′t, r ′ > r .

zr+1 ← Compress(hK (x) ‖ yr+1)

...

zr ′ ← Compress(zr ′−1 ‖ yr ′).

hK (x ′) = zr ′ .

=⇒ (1, 1)− forger

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 25 / 35

Page 52: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Message Authentication Codes (MACs)

Example (Iterated hash function hK with IV = K )

Compress : {0, 1}m+t → {0, 1}m. Given: (x , hK (x))

y = x ‖Pad(x), |y | = rt.

x ′ = x ‖Pad(x) ‖w .

y ′ = x ‖Pad(x) ‖w ‖Pad(x ′),∣∣y ′∣∣ = r ′t, r ′ > r .

zr+1 ← Compress(hK (x) ‖ yr+1)

...

zr ′ ← Compress(zr ′−1 ‖ yr ′).

hK (x ′) = zr ′ .=⇒ (1, 1)− forger

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 25 / 35

Page 53: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Message Authentication Codes (MACs) Nested MACs, HMAC and CBC-MAC

Nested MACs

Hash families (X ,Y,L,H) and (Y,Z,K,G), |X | < |Y| 6 |Z|.

(X ,Z,M,G ◦ H) nested MAC,

M = K × L, G ◦ H ={(g ◦ h)(K ,L) : gK ∈ G, hL ∈ H

}.

Theorem

Let (X ,Z,M,G ◦ H) be a nested MAC. Suppose there does not exist an(ε1, q + 1)-collision attack for a hL ∈ H (L secret), and there does notexist an (ε2, q)-forger for a gK ∈ G. Further suppose there exists an(ε, q)-forger for (g ◦ h)(K ,L) ∈ G ◦ H. Then

ε 6 ε1 + ε2.

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 26 / 35

Page 54: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Message Authentication Codes (MACs) Nested MACs, HMAC and CBC-MAC

Nested MACs

Hash families (X ,Y,L,H) and (Y,Z,K,G), |X | < |Y| 6 |Z|.

(X ,Z,M,G ◦ H) nested MAC,

M = K × L, G ◦ H ={(g ◦ h)(K ,L) : gK ∈ G, hL ∈ H

}.

Theorem

Let (X ,Z,M,G ◦ H) be a nested MAC. Suppose there does not exist an(ε1, q + 1)-collision attack for a hL ∈ H (L secret), and there does notexist an (ε2, q)-forger for a gK ∈ G. Further suppose there exists an(ε, q)-forger for (g ◦ h)(K ,L) ∈ G ◦ H. Then

ε 6 ε1 + ε2.

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 26 / 35

Page 55: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Message Authentication Codes (MACs) Nested MACs, HMAC and CBC-MAC

HMAC

ipad = 3636 · · · 36,opad = 5C5C · · · 5C.

(512-bit)

512-bit key K .

Cryptosystem: HMAC(x ,K )

HMACK (x) = SHA-1((K ⊕ opad) ‖SHA-1((K ⊕ ipad) ‖ x))

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 27 / 35

Page 56: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Message Authentication Codes (MACs) Nested MACs, HMAC and CBC-MAC

CBC-MAC

(P, C,K, E ,D) endomorphic cryptosystem, P = C = {0, 1}t .

K ∈ K, eK ∈ E .

Cryptosystem: CBC-MAC(x ,K )

1: denote x = x1 ‖ · · · ‖ xn, |xi | = t2: y0 ← 00 · · · 0 . initial value3: for i ← 1 to n do yi ← eK (yi−1 ⊕ xi )4: return yn

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 28 / 35

Page 57: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Message Authentication Codes (MACs) Unconditionally Secure MACs

Unconditionally Secure MACs

a key is used to produce only one authentication tag

impersonation: (ε, 0)-forger

substitution: (ε, 1)-forger

deception probability Pdq: maximum value of ε such that (ε, q)-forgerexists (q = 0, 1)

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 29 / 35

Page 58: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Message Authentication Codes (MACs) Unconditionally Secure MACs

Example

X = Y = Z3, K = Z3 × Z3,H =

{h(a,b) : (a, b) ∈ K

}h(a,b)(x) = ax + b (mod 3).

=⇒ Pd0 = Pd1 = 13

key 0 1 2

(0, 0) 0 0 0

(0, 1) 1 1 1

(0, 2) 2 2 2

(1, 0) 0 1 2

(1, 1) 1 2 0

(1, 2) 2 0 1

(2, 0) 0 2 1

(2, 1) 1 0 2

(2, 2) 2 1 0

Figure: AuthenticationMatrix

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 30 / 35

Page 59: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Message Authentication Codes (MACs) Unconditionally Secure MACs

Example

X = Y = Z3, K = Z3 × Z3,H =

{h(a,b) : (a, b) ∈ K

}h(a,b)(x) = ax + b (mod 3).

=⇒ Pd0 = Pd1 = 13

key 0 1 2

(0, 0) 0 0 0

(0, 1) 1 1 1

(0, 2) 2 2 2

(1, 0) 0 1 2

(1, 1) 1 2 0

(1, 2) 2 0 1

(2, 0) 0 2 1

(2, 1) 1 0 2

(2, 2) 2 1 0

Figure: AuthenticationMatrix

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 30 / 35

Page 60: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Message Authentication Codes (MACs) Unconditionally Secure MACs

Example

X = Y = Z3, K = Z3 × Z3,H =

{h(a,b) : (a, b) ∈ K

}h(a,b)(x) = ax + b (mod 3).

=⇒ Pd0 = Pd1 = 13

key 0 1 2

(0, 0) 0 0 0

(0, 1) 1 1 1

(0, 2) 2 2 2

(1, 0) 0 1 2

(1, 1) 1 2 0

(1, 2) 2 0 1

(2, 0) 0 2 1

(2, 1) 1 0 2

(2, 2) 2 1 0

Figure: AuthenticationMatrix

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 30 / 35

Page 61: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Message Authentication Codes (MACs) Unconditionally Secure MACs

Computation of Deception Probabilities

payoff(x , y) = Pr [y = hK0(x)] =|{K ∈ K : hK (x) = y}|

|K|.

Pd0 = max {payoff(x , y) : x ∈ X , y ∈ Y} .

payoff(x ′, y ′; x , y) = Pr[y ′ = hK0(x

′) | y = hK0(x)]

=Pr [y ′ = hK0(x

′) ∧ y = hK0(x)]

Pr [y = hK0(x)]

=|{K ∈ K : hK (x ′) = y ′, hK (x) = y}|

|{K ∈ K : hK (x) = y}|.

V = {(x , y) : |{K ∈ K : hK (x) = y}| > 1} .

Pd1 = max{payoff(x ′, y ′; x , y) : x 6= x ′ ∈ X , y , y ′ ∈ Y, (x , y) ∈ V

}.

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 31 / 35

Page 62: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Message Authentication Codes (MACs) Unconditionally Secure MACs

Computation of Deception Probabilities

payoff(x , y) = Pr [y = hK0(x)] =|{K ∈ K : hK (x) = y}|

|K|.

Pd0 = max {payoff(x , y) : x ∈ X , y ∈ Y} .

payoff(x ′, y ′; x , y) = Pr[y ′ = hK0(x

′) | y = hK0(x)]

=Pr [y ′ = hK0(x

′) ∧ y = hK0(x)]

Pr [y = hK0(x)]

=|{K ∈ K : hK (x ′) = y ′, hK (x) = y}|

|{K ∈ K : hK (x) = y}|.

V = {(x , y) : |{K ∈ K : hK (x) = y}| > 1} .

Pd1 = max{payoff(x ′, y ′; x , y) : x 6= x ′ ∈ X , y , y ′ ∈ Y, (x , y) ∈ V

}.

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 31 / 35

Page 63: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Message Authentication Codes (MACs) Unconditionally Secure MACs

Computation of Deception Probabilities

payoff(x , y) = Pr [y = hK0(x)] =|{K ∈ K : hK (x) = y}|

|K|.

Pd0 = max {payoff(x , y) : x ∈ X , y ∈ Y} .

payoff(x ′, y ′; x , y) = Pr[y ′ = hK0(x

′) | y = hK0(x)]

=Pr [y ′ = hK0(x

′) ∧ y = hK0(x)]

Pr [y = hK0(x)]

=|{K ∈ K : hK (x ′) = y ′, hK (x) = y}|

|{K ∈ K : hK (x) = y}|.

V = {(x , y) : |{K ∈ K : hK (x) = y}| > 1} .

Pd1 = max{payoff(x ′, y ′; x , y) : x 6= x ′ ∈ X , y , y ′ ∈ Y, (x , y) ∈ V

}.

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 31 / 35

Page 64: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Message Authentication Codes (MACs) Unconditionally Secure MACs

Computation of Deception Probabilities

payoff(x , y) = Pr [y = hK0(x)] =|{K ∈ K : hK (x) = y}|

|K|.

Pd0 = max {payoff(x , y) : x ∈ X , y ∈ Y} .

payoff(x ′, y ′; x , y) = Pr[y ′ = hK0(x

′) | y = hK0(x)]

=Pr [y ′ = hK0(x

′) ∧ y = hK0(x)]

Pr [y = hK0(x)]

=|{K ∈ K : hK (x ′) = y ′, hK (x) = y}|

|{K ∈ K : hK (x) = y}|.

V = {(x , y) : |{K ∈ K : hK (x) = y}| > 1} .

Pd1 = max{payoff(x ′, y ′; x , y) : x 6= x ′ ∈ X , y , y ′ ∈ Y, (x , y) ∈ V

}.

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 31 / 35

Page 65: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Message Authentication Codes (MACs) Unconditionally Secure MACs

Computation of Deception Probabilities

payoff(x , y) = Pr [y = hK0(x)] =|{K ∈ K : hK (x) = y}|

|K|.

Pd0 = max {payoff(x , y) : x ∈ X , y ∈ Y} .

payoff(x ′, y ′; x , y) = Pr[y ′ = hK0(x

′) | y = hK0(x)]

=Pr [y ′ = hK0(x

′) ∧ y = hK0(x)]

Pr [y = hK0(x)]

=|{K ∈ K : hK (x ′) = y ′, hK (x) = y}|

|{K ∈ K : hK (x) = y}|.

V = {(x , y) : |{K ∈ K : hK (x) = y}| > 1} .

Pd1 = max{payoff(x ′, y ′; x , y) : x 6= x ′ ∈ X , y , y ′ ∈ Y, (x , y) ∈ V

}.

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 31 / 35

Page 66: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Message Authentication Codes (MACs) Unconditionally Secure MACs

Strongly Universal Hash Families

Definition

Let (X ,Y,K,H) be an (N,M)-hash family. This hash family is stronglyuniversal, if ∣∣{K ∈ K : hK (x) = y , hK (x ′) = y ′

}∣∣ = |K|M2

for all x , x ′ ∈ X such that x 6= x ′, and for all y , y ′ ∈ Y.

Lemma

Let (X ,Y,K,H) be a strongly universal (N,M)-hash family. Then

|{K ∈ K : hK (x) = y}| = |K|M

∀x ∈ X ∀y ∈ Y.

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 32 / 35

Page 67: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Message Authentication Codes (MACs) Unconditionally Secure MACs

Strongly Universal Hash Families

Definition

Let (X ,Y,K,H) be an (N,M)-hash family. This hash family is stronglyuniversal, if ∣∣{K ∈ K : hK (x) = y , hK (x ′) = y ′

}∣∣ = |K|M2

for all x , x ′ ∈ X such that x 6= x ′, and for all y , y ′ ∈ Y.

Lemma

Let (X ,Y,K,H) be a strongly universal (N,M)-hash family. Then

|{K ∈ K : hK (x) = y}| = |K|M

∀x ∈ X ∀y ∈ Y.

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 32 / 35

Page 68: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Message Authentication Codes (MACs) Unconditionally Secure MACs

Proof.

Let x , x ′ ∈ X such that x 6= x ′, and let y ∈ Y.

|{K ∈ K : hK (x) = y}| =∑y ′∈Y

∣∣{K ∈ K : hK (x) = y , hK (x ′) = y ′}∣∣

=∑y ′∈Y

|K|M2

=|K|M

.

Theorem

Let (X ,Y,K,H) be a strongly universal (N,M)-hash family. Then(X ,Y,K,H) is an authentication code with

Pd0 = Pd1 =1

M.

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 33 / 35

Page 69: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Message Authentication Codes (MACs) Unconditionally Secure MACs

Proof.

Let x , x ′ ∈ X such that x 6= x ′, and let y ∈ Y.

|{K ∈ K : hK (x) = y}| =∑y ′∈Y

∣∣{K ∈ K : hK (x) = y , hK (x ′) = y ′}∣∣

=∑y ′∈Y

|K|M2

=|K|M

.

Theorem

Let (X ,Y,K,H) be a strongly universal (N,M)-hash family. Then(X ,Y,K,H) is an authentication code with

Pd0 = Pd1 =1

M.

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 33 / 35

Page 70: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Message Authentication Codes (MACs) Unconditionally Secure MACs

Proof.

Let x ∈ X and y ∈ Y.

payoff(x , y) =|{K ∈ K : hK (x) = y}|

|K|=|K| /M

|K|=

1

M.

Now let x , x ′ ∈ X such that x 6= x ′, and let y , y ′ ∈ Y, where (x , y) ∈ V.

payoff(x ′, y ′; x , y) =|{K ∈ K : hK (x ′) = y ′, hK (x) = y}|

|{K ∈ K : hK (x) = y}|

=|K| /M2

|K| /M=

1

M.

=⇒ Pd0 = Pd1 =1

M

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 34 / 35

Page 71: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Message Authentication Codes (MACs) Unconditionally Secure MACs

Proof.

Let x ∈ X and y ∈ Y.

payoff(x , y) =|{K ∈ K : hK (x) = y}|

|K|=|K| /M

|K|=

1

M.

Now let x , x ′ ∈ X such that x 6= x ′, and let y , y ′ ∈ Y, where (x , y) ∈ V.

payoff(x ′, y ′; x , y) =|{K ∈ K : hK (x ′) = y ′, hK (x) = y}|

|{K ∈ K : hK (x) = y}|

=|K| /M2

|K| /M=

1

M.

=⇒ Pd0 = Pd1 =1

M

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 34 / 35

Page 72: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

Message Authentication Codes (MACs) Unconditionally Secure MACs

Proof.

Let x ∈ X and y ∈ Y.

payoff(x , y) =|{K ∈ K : hK (x) = y}|

|K|=|K| /M

|K|=

1

M.

Now let x , x ′ ∈ X such that x 6= x ′, and let y , y ′ ∈ Y, where (x , y) ∈ V.

payoff(x ′, y ′; x , y) =|{K ∈ K : hK (x ′) = y ′, hK (x) = y}|

|{K ∈ K : hK (x) = y}|

=|K| /M2

|K| /M=

1

M.

=⇒ Pd0 = Pd1 =1

M

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 34 / 35

Page 73: One-Way Encryption and Message Authentication · Introduction Definitions Definition A hash family is a four-tuple (X,Y,K,H), where: 1 Xis a set of possible messages 2 Yis a finite

References

Thanks for listening!

For further reading:

Douglas R. StinsonCryptography: Theory and Practice2nd ed., Chapman & Hall/CRC, 2002.

Bruce SchneierApplied Cryptography: Protocols, Algorithms, and Source Code in CJohn Wiley & Sons, Inc., 1994.

Bart van RompayAnalysis and Design of Cryptographic Hash Functions, MACAlgorithms and Block CiphersPh.D. thesis, Katholieke Universiteit Leuven, 2004.

Johannes Mittmann (TU Munchen) One-Way Encryption JASS 2005 – IT Security 35 / 35