kangarootwelve: fast hashing based on keccak-p · 2019. 6. 20. · * cv cv cv cv cv n-1ffff 06 s1...

36
KangarooTwelve: fast hashing based on Keccak-p Guido Bertoni 3 Joan Daemen 1,2 Michaël Peeters 1 Gilles Van Assche 1 Ronny Van Keer 1 Benoît Viguier 2 1 STMicroelectronics 2 Radboud University 3 Security Pattern The 16th International Conference on Applied Cryptography and Network Security Leuven, Belgium, July 2018 1 / 19

Upload: others

Post on 03-Oct-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: KangarooTwelve: fast hashing based on Keccak-p · 2019. 6. 20. · * CV CV CV CV CV n-1FFFF 06 S1 0B S2 0B S3 0B Sn-2 0B Sn-1 0B eXtendableOutputFunction Treeontopofspongeconst.+Sakuracoding

KangarooTwelve: fast hashing based on Keccak-p

Guido Bertoni3 Joan Daemen1,2 Michaël Peeters1Gilles Van Assche1 Ronny Van Keer1 Benoît Viguier2

1STMicroelectronics2Radboud University3Security Pattern

The 16th International Conference onApplied Cryptography and Network Security

Leuven, Belgium, July 2018

1 / 19

Page 2: KangarooTwelve: fast hashing based on Keccak-p · 2019. 6. 20. · * CV CV CV CV CV n-1FFFF 06 S1 0B S2 0B S3 0B Sn-2 0B Sn-1 0B eXtendableOutputFunction Treeontopofspongeconst.+Sakuracoding

Outline

1 What is KangarooTwelve?

2 Security vs speed

3 Speed vs security

2 / 19

Page 3: KangarooTwelve: fast hashing based on Keccak-p · 2019. 6. 20. · * CV CV CV CV CV n-1FFFF 06 S1 0B S2 0B S3 0B Sn-2 0B Sn-1 0B eXtendableOutputFunction Treeontopofspongeconst.+Sakuracoding

What is KangarooTwelve?

Outline

1 What is KangarooTwelve?

2 Security vs speed

3 Speed vs security

3 / 19

Page 4: KangarooTwelve: fast hashing based on Keccak-p · 2019. 6. 20. · * CV CV CV CV CV n-1FFFF 06 S1 0B S2 0B S3 0B Sn-2 0B Sn-1 0B eXtendableOutputFunction Treeontopofspongeconst.+Sakuracoding

What is KangarooTwelve?

Let’s start from SHAKE128

input output

outerinner

0

0

r

c

f f f f f f

absorbing squeezingeXtendable Output FunctionSponge constructionUses Keccak-p[1600,nr = 24]No parallelism at construction level

4 / 19

Page 5: KangarooTwelve: fast hashing based on Keccak-p · 2019. 6. 20. · * CV CV CV CV CV n-1FFFF 06 S1 0B S2 0B S3 0B Sn-2 0B Sn-1 0B eXtendableOutputFunction Treeontopofspongeconst.+Sakuracoding

What is KangarooTwelve?

From SHAKE128 to KangarooTwelve

S0 0300* CV CV CV … CV CV n-1 FFFF 06

S1

0B

S2

0B

S3

0B

Sn-2

0B

Sn-1

0B

eXtendable Output FunctionTree on top of sponge constructionUses Keccak-p[1600,nr = 12]Parallelism grows automatically with input size

5 / 19

Page 6: KangarooTwelve: fast hashing based on Keccak-p · 2019. 6. 20. · * CV CV CV CV CV n-1FFFF 06 S1 0B S2 0B S3 0B Sn-2 0B Sn-1 0B eXtendableOutputFunction Treeontopofspongeconst.+Sakuracoding

What is KangarooTwelve?

From SHAKE128 to KangarooTwelve

S0 0300* CV CV CV … CV CV n-1 FFFF 06

S1

0B

S2

0B

S3

0B

Sn-2

0B

Sn-1

0B

eXtendable Output FunctionTree on top of sponge const. +Sakura codingUses Keccak-p[1600,nr = 12]Parallelism grows automatically with input size

5 / 19

Page 7: KangarooTwelve: fast hashing based on Keccak-p · 2019. 6. 20. · * CV CV CV CV CV n-1FFFF 06 S1 0B S2 0B S3 0B Sn-2 0B Sn-1 0B eXtendableOutputFunction Treeontopofspongeconst.+Sakuracoding

What is KangarooTwelve?

From SHAKE128 to KangarooTwelve

S0 0300* CV CV CV … CV CV n-1 FFFF 06

S1

0B

S2

0B

S3

0B

Sn-2

0B

Sn-1

0B

eXtendable Output FunctionTree on top of sponge const. +Sakura coding +kangaroo hoppingUses Keccak-p[1600,nr = 12]Parallelism grows automatically with input size

5 / 19

Page 8: KangarooTwelve: fast hashing based on Keccak-p · 2019. 6. 20. · * CV CV CV CV CV n-1FFFF 06 S1 0B S2 0B S3 0B Sn-2 0B Sn-1 0B eXtendableOutputFunction Treeontopofspongeconst.+Sakuracoding

What is KangarooTwelve?

From SHAKE128 to KangarooTwelve

S0 0300* CV CV CV … CV CV n-1 FFFF 06

S1

0B

S2

0B

S3

0B

Sn-2

0B

Sn-1

0B

eXtendable Output FunctionTree on top of sponge const. +Sakura coding +kangaroo hoppingUses Keccak-p[1600,nr = 12]Parallelism grows automatically with input size (per 8KiB)

5 / 19

Page 9: KangarooTwelve: fast hashing based on Keccak-p · 2019. 6. 20. · * CV CV CV CV CV n-1FFFF 06 S1 0B S2 0B S3 0B Sn-2 0B Sn-1 0B eXtendableOutputFunction Treeontopofspongeconst.+Sakuracoding

Security vs speed

Outline

1 What is KangarooTwelve?

2 Security vs speed

3 Speed vs security

6 / 19

Page 10: KangarooTwelve: fast hashing based on Keccak-p · 2019. 6. 20. · * CV CV CV CV CV n-1FFFF 06 S1 0B S2 0B S3 0B Sn-2 0B Sn-1 0B eXtendableOutputFunction Treeontopofspongeconst.+Sakuracoding

Security vs speed

KangarooTwelve targets 128-bit security

Flat sponge claim: 128-bit security strengthCollision resistance(Second-) preimage resistance

Multi-target preimage resistanceChosen-target forced-prefix preimage resistance

Correlation-freenessResistance against length-extension attacks…

What about 256-bit security?Philosophically much higherBut practically the same: well above the attacker’s budgetMarsupilamiFourteen

7 / 19

Page 11: KangarooTwelve: fast hashing based on Keccak-p · 2019. 6. 20. · * CV CV CV CV CV n-1FFFF 06 S1 0B S2 0B S3 0B Sn-2 0B Sn-1 0B eXtendableOutputFunction Treeontopofspongeconst.+Sakuracoding

Security vs speed

KangarooTwelve targets 128-bit security

Flat sponge claim: 128-bit security strengthCollision resistance(Second-) preimage resistance

Multi-target preimage resistanceChosen-target forced-prefix preimage resistance

Correlation-freenessResistance against length-extension attacks…

What about 256-bit security?Philosophically much higherBut practically the same: well above the attacker’s budgetMarsupilamiFourteen

7 / 19

Page 12: KangarooTwelve: fast hashing based on Keccak-p · 2019. 6. 20. · * CV CV CV CV CV n-1FFFF 06 S1 0B S2 0B S3 0B Sn-2 0B Sn-1 0B eXtendableOutputFunction Treeontopofspongeconst.+Sakuracoding

Security vs speed

KangarooTwelve targets 128-bit security

Flat sponge claim: 128-bit security strengthCollision resistance(Second-) preimage resistance

Multi-target preimage resistanceChosen-target forced-prefix preimage resistance

Correlation-freenessResistance against length-extension attacks…

What about 256-bit security?Philosophically much higherBut practically the same: well above the attacker’s budgetMarsupilamiFourteen

7 / 19

Page 13: KangarooTwelve: fast hashing based on Keccak-p · 2019. 6. 20. · * CV CV CV CV CV n-1FFFF 06 S1 0B S2 0B S3 0B Sn-2 0B Sn-1 0B eXtendableOutputFunction Treeontopofspongeconst.+Sakuracoding

Security vs speed

KangarooTwelve targets 128-bit security

Flat sponge claim: 128-bit security strengthCollision resistance(Second-) preimage resistance

Multi-target preimage resistanceChosen-target forced-prefix preimage resistance

Correlation-freenessResistance against length-extension attacks…

What about 256-bit security?Philosophically much higherBut practically the same: well above the attacker’s budgetMarsupilamiFourteen

7 / 19

Page 14: KangarooTwelve: fast hashing based on Keccak-p · 2019. 6. 20. · * CV CV CV CV CV n-1FFFF 06 S1 0B S2 0B S3 0B Sn-2 0B Sn-1 0B eXtendableOutputFunction Treeontopofspongeconst.+Sakuracoding

Security vs speed

First pillar of security in symmetric cryptography

Generic securityStrong mathematical proofs⇒ mode introduces no weaknesses⇒ scope of cryptanalysis focused on primitive

In our case:[EuroCrypt 2008] – On the Indifferentiability of the Sponge Construction[IJIS 2014] – Sufficient conditions for sound tree and sequential hashing modes[ACNS 2014] – Sakura: A Flexible Coding for Tree Hashing

8 / 19

Page 15: KangarooTwelve: fast hashing based on Keccak-p · 2019. 6. 20. · * CV CV CV CV CV n-1FFFF 06 S1 0B S2 0B S3 0B Sn-2 0B Sn-1 0B eXtendableOutputFunction Treeontopofspongeconst.+Sakuracoding

Security vs speed

First pillar of security in symmetric cryptography

Generic securityStrong mathematical proofs⇒ mode introduces no weaknesses⇒ scope of cryptanalysis focused on primitive

In our case:[EuroCrypt 2008] – On the Indifferentiability of the Sponge Construction[IJIS 2014] – Sufficient conditions for sound tree and sequential hashing modes[ACNS 2014] – Sakura: A Flexible Coding for Tree Hashing

8 / 19

Page 16: KangarooTwelve: fast hashing based on Keccak-p · 2019. 6. 20. · * CV CV CV CV CV n-1FFFF 06 S1 0B S2 0B S3 0B Sn-2 0B Sn-1 0B eXtendableOutputFunction Treeontopofspongeconst.+Sakuracoding

Security vs speed

First pillar of security in symmetric cryptography

Generic securityStrong mathematical proofs⇒ mode introduces no weaknesses⇒ scope of cryptanalysis focused on primitive

In our case:[EuroCrypt 2008] – On the Indifferentiability of the Sponge Construction[IJIS 2014] – Sufficient conditions for sound tree and sequential hashing modes[ACNS 2014] – Sakura: A Flexible Coding for Tree Hashing

8 / 19

Page 17: KangarooTwelve: fast hashing based on Keccak-p · 2019. 6. 20. · * CV CV CV CV CV n-1FFFF 06 S1 0B S2 0B S3 0B Sn-2 0B Sn-1 0B eXtendableOutputFunction Treeontopofspongeconst.+Sakuracoding

Security vs speed

Second pillar of security in symmetric cryptography

Security of the primitiveNo proof!⇒ publicly documented design rationale⇒ cryptanalysis!

In our case:Ten years of cryptanalysis on (reduced-round) Keccak-f[1600]⇐ tune the number of rounds⇐ no tweak!

9 / 19

Page 18: KangarooTwelve: fast hashing based on Keccak-p · 2019. 6. 20. · * CV CV CV CV CV n-1FFFF 06 S1 0B S2 0B S3 0B Sn-2 0B Sn-1 0B eXtendableOutputFunction Treeontopofspongeconst.+Sakuracoding

Security vs speed

Second pillar of security in symmetric cryptography

Security of the primitiveNo proof!⇒ publicly documented design rationale⇒ cryptanalysis!

In our case:Ten years of cryptanalysis on (reduced-round) Keccak-f[1600]⇐ tune the number of rounds⇐ no tweak!

9 / 19

Page 19: KangarooTwelve: fast hashing based on Keccak-p · 2019. 6. 20. · * CV CV CV CV CV n-1FFFF 06 S1 0B S2 0B S3 0B Sn-2 0B Sn-1 0B eXtendableOutputFunction Treeontopofspongeconst.+Sakuracoding

Security vs speed

Second pillar of security in symmetric cryptography

Security of the primitiveNo proof!⇒ publicly documented design rationale⇒ cryptanalysis!

In our case:Ten years of cryptanalysis on (reduced-round) Keccak-f[1600]⇐ tune the number of rounds⇐ no tweak!

9 / 19

Page 20: KangarooTwelve: fast hashing based on Keccak-p · 2019. 6. 20. · * CV CV CV CV CV n-1FFFF 06 S1 0B S2 0B S3 0B Sn-2 0B Sn-1 0B eXtendableOutputFunction Treeontopofspongeconst.+Sakuracoding

Security vs speed

Second pillar of security in symmetric cryptography

Security of the primitiveNo proof!⇒ publicly documented design rationale⇒ third-party cryptanalysis!

In our case:Ten years of cryptanalysis on (reduced-round) Keccak-f[1600]⇐ tune the number of rounds⇐ no tweak!

9 / 19

Page 21: KangarooTwelve: fast hashing based on Keccak-p · 2019. 6. 20. · * CV CV CV CV CV n-1FFFF 06 S1 0B S2 0B S3 0B Sn-2 0B Sn-1 0B eXtendableOutputFunction Treeontopofspongeconst.+Sakuracoding

Security vs speed

Second pillar of security in symmetric cryptography

Security of the primitiveNo proof!⇒ publicly documented design rationale⇒ lots of third-party cryptanalysis!

In our case:Ten years of cryptanalysis on (reduced-round) Keccak-f[1600]⇐ tune the number of rounds⇐ no tweak!

9 / 19

Page 22: KangarooTwelve: fast hashing based on Keccak-p · 2019. 6. 20. · * CV CV CV CV CV n-1FFFF 06 S1 0B S2 0B S3 0B Sn-2 0B Sn-1 0B eXtendableOutputFunction Treeontopofspongeconst.+Sakuracoding

Security vs speed

Second pillar of security in symmetric cryptography

Security of the primitiveNo proof!⇒ publicly documented design rationale⇒ lots of third-party cryptanalysis!

In our case:Ten years of cryptanalysis on (reduced-round) Keccak-f[1600]⇐ tune the number of rounds⇐ no tweak!

9 / 19

Page 23: KangarooTwelve: fast hashing based on Keccak-p · 2019. 6. 20. · * CV CV CV CV CV n-1FFFF 06 S1 0B S2 0B S3 0B Sn-2 0B Sn-1 0B eXtendableOutputFunction Treeontopofspongeconst.+Sakuracoding

Security vs speed

Status of Keccak & KangarooTwelve cryptanalysisKe

ccak

-f [1

600]

0

3

6

9

12

15

18

21

24Collision attacks up to 5 rounds

Also up to 6 rounds, but for non-standardparameters (c = 160)

[Song, Liao, Guo, CRYPTO 2017]Distinguishers

7 rounds (practical time)[Huang et al., EUROCRYPT 2017]8 rounds (2128 time, academic)[Dinur et al., EUROCRYPT 2015]

Lots of third-party cryptanalysis available at:https://keccak.team/third_party.html

10 / 19

Page 24: KangarooTwelve: fast hashing based on Keccak-p · 2019. 6. 20. · * CV CV CV CV CV n-1FFFF 06 S1 0B S2 0B S3 0B Sn-2 0B Sn-1 0B eXtendableOutputFunction Treeontopofspongeconst.+Sakuracoding

Speed vs security

Outline

1 What is KangarooTwelve?

2 Security vs speed

3 Speed vs security

11 / 19

Page 25: KangarooTwelve: fast hashing based on Keccak-p · 2019. 6. 20. · * CV CV CV CV CV n-1FFFF 06 S1 0B S2 0B S3 0B Sn-2 0B Sn-1 0B eXtendableOutputFunction Treeontopofspongeconst.+Sakuracoding

Speed vs security

Low-end vs high-end

How to optimize for both low-end and high-end platforms?Avoid 32-bit/64-bit mismatches

32-bit 64-bitSHA-256 √

±SHA-512 ±

12 / 19

Page 26: KangarooTwelve: fast hashing based on Keccak-p · 2019. 6. 20. · * CV CV CV CV CV n-1FFFF 06 S1 0B S2 0B S3 0B Sn-2 0B Sn-1 0B eXtendableOutputFunction Treeontopofspongeconst.+Sakuracoding

Speed vs security

Low-end vs high-end

How to optimize for both low-end and high-end platforms?Avoid 32-bit/64-bit mismatches

32-bit 64-bitSHA-256 √

±SHA-512 ±

12 / 19

Page 27: KangarooTwelve: fast hashing based on Keccak-p · 2019. 6. 20. · * CV CV CV CV CV n-1FFFF 06 S1 0B S2 0B S3 0B Sn-2 0B Sn-1 0B eXtendableOutputFunction Treeontopofspongeconst.+Sakuracoding

Speed vs security

Bit interleaving

= +

32-bit 64-bitKeccak-f[ 800] √

±Keccak-f[1600] √ √

⇒ let’s stick to Keccak-f[1600]

13 / 19

Page 28: KangarooTwelve: fast hashing based on Keccak-p · 2019. 6. 20. · * CV CV CV CV CV n-1FFFF 06 S1 0B S2 0B S3 0B Sn-2 0B Sn-1 0B eXtendableOutputFunction Treeontopofspongeconst.+Sakuracoding

Speed vs security

Exploit parallelism

At the high end:SIMD with growing widths

128, 256 and now 512 bitsMultiple cores

⇒ let’s exploit this parallelism

To remain efficient at the low end:One-level treeKangaroo hopping

14 / 19

Page 29: KangarooTwelve: fast hashing based on Keccak-p · 2019. 6. 20. · * CV CV CV CV CV n-1FFFF 06 S1 0B S2 0B S3 0B Sn-2 0B Sn-1 0B eXtendableOutputFunction Treeontopofspongeconst.+Sakuracoding

Speed vs security

Exploit parallelism

At the high end:SIMD with growing widths

128, 256 and now 512 bitsMultiple cores

⇒ let’s exploit this parallelism

To remain efficient at the low end:One-level treeKangaroo hopping

14 / 19

Page 30: KangarooTwelve: fast hashing based on Keccak-p · 2019. 6. 20. · * CV CV CV CV CV n-1FFFF 06 S1 0B S2 0B S3 0B Sn-2 0B Sn-1 0B eXtendableOutputFunction Treeontopofspongeconst.+Sakuracoding

Speed vs security

Short messages (≤ 8KiB)

Kangaroo hopping No kangaroo hopping

S0 07 CV 1 FFFF 06

S0

0B

one call to F two calls to F

15 / 19

Page 31: KangarooTwelve: fast hashing based on Keccak-p · 2019. 6. 20. · * CV CV CV CV CV n-1FFFF 06 S1 0B S2 0B S3 0B Sn-2 0B Sn-1 0B eXtendableOutputFunction Treeontopofspongeconst.+Sakuracoding

Speed vs security

How fast is KangarooTwelve?

Twice as fast as SHAKE128 on short inputs ≤ 8KiBMuch faster with parallelism on long inputs≫ 8KiB

Short input Long inputIntel® Core™ i5-4570 (Haswell) 3.68 c/b 1.44 c/bIntel® Core™ i5-6500 (Skylake) 2.89 c/b 1.22 c/bIntel® Core™ i7-7800X (SkylakeX) 2.06 c/b 0.55 c/b

Single core only.

16 / 19

Page 32: KangarooTwelve: fast hashing based on Keccak-p · 2019. 6. 20. · * CV CV CV CV CV n-1FFFF 06 S1 0B S2 0B S3 0B Sn-2 0B Sn-1 0B eXtendableOutputFunction Treeontopofspongeconst.+Sakuracoding

Speed vs security

How fast is KangarooTwelve? (AVX2)

Skylake (AVX2)cycles/byte

KangarooTwelve 1.22KangarooTwelve (≤ 8KiB) 2.89ParallelHash128 2.31SHAKE128 5.56SHA-256 6.91SHA-512 4.64Blake2bp 1.34Blake2sp 1.29Blake2b 3.04Blake2s 4.85

17 / 19

Page 33: KangarooTwelve: fast hashing based on Keccak-p · 2019. 6. 20. · * CV CV CV CV CV n-1FFFF 06 S1 0B S2 0B S3 0B Sn-2 0B Sn-1 0B eXtendableOutputFunction Treeontopofspongeconst.+Sakuracoding

Speed vs security

How fast is KangarooTwelve? (AVX-512)

Skylake (AVX2) vs SkylakeX (AVX-512)cycles/byte

KangarooTwelve 1.22 0.55KangarooTwelve (≤ 8KiB) 2.89 2.07ParallelHash128 2.31 0.96SHAKE128 5.56 4.12SHA-256 6.91 6.65SHA-512 4.64 4.44Blake2bp 1.34 1.39Blake2sp 1.29 1.22Blake2b 3.04 2.98Blake2s 4.85 4.26

Not all optimized for AVX-512 yet

18 / 19

Page 34: KangarooTwelve: fast hashing based on Keccak-p · 2019. 6. 20. · * CV CV CV CV CV n-1FFFF 06 S1 0B S2 0B S3 0B Sn-2 0B Sn-1 0B eXtendableOutputFunction Treeontopofspongeconst.+Sakuracoding

Speed vs security

How fast is KangarooTwelve? (AVX-512)

Skylake (AVX2) vs SkylakeX (AVX-512)cycles/byte

KangarooTwelve 1.22 0.55KangarooTwelve (≤ 8KiB) 2.89 2.07ParallelHash128 2.31 0.96SHAKE128 5.56 4.12SHA-256 6.91 6.65SHA-512 4.64 4.44Blake2bp 1.34 1.39Blake2sp 1.29 1.22Blake2b 3.04 2.98Blake2s 4.85 4.26

Not all optimized for AVX-512 yet

18 / 19

Page 35: KangarooTwelve: fast hashing based on Keccak-p · 2019. 6. 20. · * CV CV CV CV CV n-1FFFF 06 S1 0B S2 0B S3 0B Sn-2 0B Sn-1 0B eXtendableOutputFunction Treeontopofspongeconst.+Sakuracoding

Speed vs security

How fast is KangarooTwelve? (AVX-512)

Skylake (AVX2) vs SkylakeX (AVX-512)cycles/byte

KangarooTwelve 1.22 0.55KangarooTwelve (≤ 8KiB) 2.89 2.07ParallelHash128 2.31 0.96SHAKE128 5.56 4.12SHA-256 6.91 6.65SHA-512 4.64 4.44Blake2bp 1.34 1.39Blake2sp 1.29 1.22Blake2b 3.04 2.98Blake2s 4.85 4.26

Not all optimized for AVX-512 yet

18 / 19

Page 36: KangarooTwelve: fast hashing based on Keccak-p · 2019. 6. 20. · * CV CV CV CV CV n-1FFFF 06 S1 0B S2 0B S3 0B Sn-2 0B Sn-1 0B eXtendableOutputFunction Treeontopofspongeconst.+Sakuracoding

Conclusions

Any questions?

Thanks for your attention!More informationhttps://keccak.team/kangarootwelve.htmlSome implementationshttps://github.com/gvanas/KeccakCodePackage (C, Python)https://github.com/kerukuro/digestpp (C++)https://github.com/mimoo/GoKangarooTwelve (Go)https://rubygems.org/gems/digest-kangarootwelve (Ruby)https://github.com/damaki/libkeccak (Ada)Benoît’s RFC drafthttps://datatracker.ietf.org/doc/draft-viguier-kangarootwelve/

19 / 19