Preimage algorithms for the Tillich-Zémor hash function

26
UCL Crypto Group Microelectronics Laboratory Christophe Petit - SAC 2010 - August 2010 1 Preimage algorithms for the Tillich-Z´ emor hash function Christophe Petit and Jean-Jacques Quisquater

Transcript of Preimage algorithms for the Tillich-Zémor hash function

UCL Crypto GroupMicroelectronics Laboratory Christophe Petit - SAC 2010 - August 2010 1

Preimage algorithms for the Tillich-Zemorhash function

Christophe Petit and Jean-Jacques Quisquater

UCL Crypto GroupMicroelectronics Laboratory Christophe Petit - SAC 2010 - August 2010 2

Hash functions and Cayley graphs

I Hash functionsH : {0, 1}∗ → {0, 1}n

I “Classical”hash functions

I Tillich-Zemorhash function

UCL Crypto GroupMicroelectronics Laboratory Christophe Petit - SAC 2010 - August 2010 3

Tillich-Zemor hash function

I Mathematical structure : finite group, Cayley graph

I Proposed by Tillich-Zemor at CRYPTO’94 [TZ94]

following previous (broken) scheme by Zemor [Z91]

I Trapdoor attack [SGGB00]

I Attacks on particular parameters [SGGB00,CP94,AK98]

I Until 13 months ago, best generic attacks wereasymptotically inefficient [PQTZ08]

UCL Crypto GroupMicroelectronics Laboratory Christophe Petit - SAC 2010 - August 2010 4

Tillich-Zemor hash function

I August’09 : very efficient collision attackby Grassl, Illic, Magliveras, Steinwandt [GIMS09]

I This paper : preimage algorithms(also very efficient)

UCL Crypto GroupMicroelectronics Laboratory Christophe Petit - SAC 2010 - August 2010 5

Outline

Introduction

Tillich-Zemor hash function

Grassl et al.’s collision attack

Preimage algorithms

Conclusion

UCL Crypto GroupMicroelectronics Laboratory Christophe Petit - SAC 2010 - August 2010 6

Outline

Introduction

Tillich-Zemor hash function

Grassl et al.’s collision attack

Preimage algorithms

Conclusion

UCL Crypto GroupMicroelectronics Laboratory Christophe Petit - SAC 2010 - August 2010 7

Tillich-Zemor hash function

I p ∈ F2[X ] irreducible of degree nK = F2[X ]/(p(X )) ≈ F2n

I Group G = SL(2,K )Generators S = {A0 = ( X 1

1 0 ) ,A1 = ( X X+11 1 )}

I Message m = m1...mN ∈ {0, 1}N

H(m1m2...mN) := Am1Am2 ...AmNmod p(X )

UCL Crypto GroupMicroelectronics Laboratory Christophe Petit - SAC 2010 - August 2010 8

Hard ( ?) problems

I Balance problem : (⇔ collisions)Given G and S = {s0, ..., sk−1} ⊂ G ,find two short products

∏smi

=∏

sm′i

I Representation problem : (⇒ 2nd preimages)Given G and S = {s0, ..., sk−1} ⊂ G ,find a short product

∏smi

= 1

I Factorization problem : (⇔ preimages)Given G , g ∈ G and S = {s0, ..., sk−1} ⊂ G ,find a short product

∏smi

= g

UCL Crypto GroupMicroelectronics Laboratory Christophe Petit - SAC 2010 - August 2010 9

Outline

Introduction

Tillich-Zemor hash function

Grassl et al.’s collision attack

Preimage algorithms

Conclusion

UCL Crypto GroupMicroelectronics Laboratory Christophe Petit - SAC 2010 - August 2010 10

Changing the generators

I Let A′0 := A−10 A0A0 = ( X 1

1 0 ),Let A′1 := A−1

0 A1A0 = ( X+1 11 0 )

I Let H ′ be H but replacing A0,A1 by A′0,A′1

H ′(m) = A−10 H(m)A0

I Collision for H ′ ⇔ collision for H

I Preimage of g for H ′ ⇔ preimage of A0gA−10 for H

! Notation : we write A0,A1,H instead of A′0,A′1,H

UCL Crypto GroupMicroelectronics Laboratory Christophe Petit - SAC 2010 - August 2010 11

Link with Euclidean algorithm

I A0 = ( X 11 0 ) and A1 = ( X+1 1

1 0 ) are “Euclidean algorithmmatrices”

ai−1 = qiai + ai+1 ⇔ ( ai ai−1 ) = ( ai−1 ai−2 )(

qi 11

)I Let h be H “without modular reductions”

h(m1...mn) := Am1 ...AmN

I ( a bc d ) = h(m)⇒ the Euclidean algorithm applied to (a, b)

only produces quotients X and X + 1

UCL Crypto GroupMicroelectronics Laboratory Christophe Petit - SAC 2010 - August 2010 12

Mesirov and Sweet’s algorithm

I Theorem [MS87] : for any irreducible a ∈ F2[X ], thereexists b ∈ F2[X ] such that all quotients obtained byapplying the Euclidean algorithm to (a, b) belong to{X ,X + 1}

I The proof is constructive

UCL Crypto GroupMicroelectronics Laboratory Christophe Petit - SAC 2010 - August 2010 13

Building the collision

I Let p be the polynomial defining the field in TZ hashfunction

I Apply [MS87] to a = p : we obtain b and a messagem = m1...mN such that H(m) = ( 0 b

c d )

I Swap the first bit

H(m1m2...mN) =(

c b+dc d

)I Build the palindrome m = mN ...m2m1m1m2...mN

H(m) =(

0 11 b2

)I Observe collision

A0H(m)A0 = A1H(m)A1

UCL Crypto GroupMicroelectronics Laboratory Christophe Petit - SAC 2010 - August 2010 14

Outline

Introduction

Tillich-Zemor hash function

Grassl et al.’s collision attack

Preimage algorithms

Conclusion

UCL Crypto GroupMicroelectronics Laboratory Christophe Petit - SAC 2010 - August 2010 15

Second preimages

I Apply [MS87] to a = p : we obtain a messagem = m1...mN such that H(m) = ( 0 b

c d )

I Build the palindrome m = mN ...m2m1m1m2...mN

I ObserveI H(0m) =

(1 X+b2

0 1

)and H(m0) =

(1 0

X+b2 1

)I Both matrices have order 2⇒ H(0m0m) = H(m0m0) = I

I Preimage of I ⇒ second preimages for any messageH(m0) = I ⇒ H(mm0) = H(m0m) = H(m)

UCL Crypto GroupMicroelectronics Laboratory Christophe Petit - SAC 2010 - August 2010 16

Preimage algorithm

I Precompute preimages of(

0 bici di

)such that the set {b2

i + X} is a basis of F2n/F2

I Let m = m1...mN such that H(m) = ( 0 bc d ).

Then H(m0) =(

1 0X+b2 1

)and H(0m) =

(1 X+b2

0 1

)I The “red matrices” belong to Abelian subgroups(

1 0∑αi 1

)=∏(

1 0αi 1

)and

(1

∑βi

0 1

)=∏(

1 βi0 1

)Write any α, β in the basis {b2

i + X} using linear algebra

I Any matrix can be written as( A B

C D ) = ( X 11 0 )

δ( 1 0

α 1 ) ( X 11 0 )

(1 β0 1

)( X 1

1 0 )3 ( 1 0

γ 1

), δ ∈ {0, 1}.

UCL Crypto GroupMicroelectronics Laboratory Christophe Petit - SAC 2010 - August 2010 17

First precomputing algorithm

I Goal : obtain n messages hashing to matrices(

0 bici di

)such that the set {b2

i + X} is a basis of F2n/F2

Applying [MS87] to a = p we obtain one such message

I Idea : apply [MS87] to a = pp′i where p′i small degree

I Issue : [MS87] requires a irreducible

UCL Crypto GroupMicroelectronics Laboratory Christophe Petit - SAC 2010 - August 2010 18

First precomputing algorithm

I We extend [MS87] : Let p, p′ be nonlinear irreduciblepolynomials and let a = pp′. If

deg(

[X (X + 1)p′]−1 mod p)≤ deg(p)− 2

then the Mesirov-Sweet’s algorithm provides b such thatall quotients computed by the Euclidean algorithm appliedto (a, b) belong to {X ,X + 1}

I Heuristic arguments + experiments :I Small deg(p′i ) sufficeI Preimages of length O(n2) for TZI Probabilistic time O(n4)

UCL Crypto GroupMicroelectronics Laboratory Christophe Petit - SAC 2010 - August 2010 19

Second precomputing algorithm

I Goal : obtain n messages hashing to matrices(

0 bici di

)such that the set {b2

i + X} is a basis of F2n/F2

Applying [MS87] to a = p we obtain one such message m1

I Idea : build those messages recursivelyI Define mi := mi−10m1

I We prove that H(mi ) =(

0 bi1

ci di

)for some ci , di

I Do the elements b2i + X generate a basis of F2n/F2 ?

UCL Crypto GroupMicroelectronics Laboratory Christophe Petit - SAC 2010 - August 2010 20

Second precomputing algorithm

I We prove : If the minimal polynomial of b1 has degree n,then we can extract a basis from {b2

i + X , i = 1, ..., 2n}

I When n is prime : always succeedsI Preimage of length O(n3) for TZI Deterministic time O(n3)

I When n is not primeI Succeeds with very high probability, same complexities

(the analysis is partially heuristic)I Always succeeds in practiceI (Other attacks exist)

UCL Crypto GroupMicroelectronics Laboratory Christophe Petit - SAC 2010 - August 2010 21

Outline

Introduction

Tillich-Zemor hash function

Grassl et al.’s collision attack

Preimage algorithms

Conclusion

UCL Crypto GroupMicroelectronics Laboratory Christophe Petit - SAC 2010 - August 2010 22

Preimage algorithms for TZ hash function

I Preimages in time O(n3) given some precomputationI First precomputing algorithm :

I Preimages of length O(n2) in probabilistic time O(n4)

I Second precomputing algorithm :I Preimages of length O(n3) in deterministic time O(n3)I Full proof when n is prime

I The case n prime proves a conjecture of Babai [BS92] forthose particular parameters

UCL Crypto GroupMicroelectronics Laboratory Christophe Petit - SAC 2010 - August 2010 23

Hash functions and Cayley graphs :the end of the story ?

I Similar functions have been broken as well (Zemor, LPS,Morgenstern)

I However, all these functions used very special parametersin a sense

I Strong connections with well-known problems in graphtheory and group theory, with many applications incomputer science (expander graphs...)

I Next challenge : SL(2,F2n) with A0 =(

t0 11 0

), A1 =

(t1 11 0

)and t0 + t1 6= 1

UCL Crypto GroupMicroelectronics Laboratory Christophe Petit - SAC 2010 - August 2010 24

References

I [TZ94] JP Tillich & G Zemor, Group-theoretic hashfunctions

I [Z91] G Zemor, Hash functions and graphs with largegirths

I [SGGB00] R Steinwandt, M Grassl, W Geiselmann, TBeth, Weaknesses in the SL2(F n

2 ) Hashing Scheme

I [CP94] C Charnes, J Pieprzyk, Attacking the SL2 hashingscheme

I [AK98] K Abdukhalikov, C Kim, On the security of thehashing scheme based on SL2

UCL Crypto GroupMicroelectronics Laboratory Christophe Petit - SAC 2010 - August 2010 25

References

I [PQTZ09] C Petit, JJ Quisquater, JP Tillich, G Zemor,Hard and easy Components of Collision Search in theZemor-Tillich Hash Function : New Instances andReduced Variants with equivalent Security

I [GIMS09] M Grassl, I Ilic, S Magliveras, R Steinwandt,Cryptanalysis of the Tillich-Zemor hash function

I [MS87] JP Mesirov, MM Sweet, Continued fractionexpansions of rational expressions with irreducibledenominators in characteristic 2

I [BS92] L Babai, A Seress, On the diameter ofpermutation groups

UCL Crypto GroupMicroelectronics Laboratory Christophe Petit - SAC 2010 - August 2010 26

References

I [CGL09] D Charles, E Goren, K Lauter, Cryptographichash functions from expander graphs

I [PLQ07] C Petit, K Lauter, JJ Quisquater, CayleyHashes : A Class of Efficient Graph-based Hash Functions

I [LPS88] A Lubotzky, R Phillips, P Sarnak, RamanujanGraphs

I [TZ08] JP Tillich, G Zemor, Collisions for the LPSExpander Graph Hash Function

I [PLQ08] C Petit, K Lauter, JJ Quisquater, FullCryptanalysis of LPS and Morgenstern Hash Functions