Memory Hard Jol Alwen Binyi Chen IST Austria UCSB Krzysztof - - PowerPoint PPT Presentation

β–Ά
memory hard
SMART_READER_LITE
LIVE PREVIEW

Memory Hard Jol Alwen Binyi Chen IST Austria UCSB Krzysztof - - PowerPoint PPT Presentation

Scrypt is Maximally Memory Hard Jol Alwen Binyi Chen IST Austria UCSB Krzysztof Pietrzak Leonid Reyzin Stefano Tessaro IST Austria Boston University UCSB Password hashing: Store a hash of a password + salt


slide-1
SLIDE 1

JoΓ«l Alwen IST Austria Krzysztof Pietrzak IST Austria Leonid Reyzin Boston University Stefano Tessaro UCSB Binyi Chen UCSB

Scrypt is Maximally Memory Hard

slide-2
SLIDE 2

F

password salt

Password hashing: Store a hash of a password + salt

F(salt || password)

F is moderately hard

Honest users can still login quickly. Brute-force attack is infeasible.

Traditional hardness metric: Time complexity (e.g., PKCS #5)

β‰ˆ 1 evaluation of F Many evaluations of F

$5$MnfsQ4iN$ZMTppKN16y/tIsUYs/

  • bHlhdP.Os80yXhTurpBMUbA5
slide-3
SLIDE 3

Honest users (General-purpose CPU) cost per F eval = 𝑫 Adversaries (ASICs) cost per F eval = 𝑫′ β‰ͺ 𝑫

better parallelization, pipelining for speedup; lower energy costs …

ASIC-resistance

Can we enforce 𝑫′ β‰ˆ 𝑫 ?

Idea: Memory costs (e.g., on-chip area, access time, $-cost) are platform independent

slide-4
SLIDE 4

Memory-hard functions (MHFs)[Percival, 2009]

Fast evaluation of MHF F β‡’ large memory Small memory β‡’ slow evaluation of MHF F

slide-5
SLIDE 5

π‘ˆ

Memory-hardness, more precisely

CMC = σ𝑒=0

π‘ˆ

Memory(𝑒)

Memory usage Time

[Alwen and Serbinenko, STOC ’15]

Goal: Maximize cumulative memory complexity (CMC) for any (possibly parallelized) strategy to evaluate F.

Time needed to evaluate F

slide-6
SLIDE 6

Memory-hardness

Memory-hardness was de- facto requirement for PHC

Many memory-hard candidates: Argon2d, Argon2i, Scrypt, Lyra2, Balloon hashing, Catena, Yescrypt, ……

Can we build provably memory-hard functions?

slide-7
SLIDE 7

Towards optimal memory hardness

(1) No iMHF achieves optimal memory hardness.

memory 𝐽1 𝑃1

MHF

𝐽2 𝑃2

MHF

memory

Previous provably MHFs [AS15,BCS16,ABP17] are iMHFs: data-independent memory access patterns!

(2) Practical iMHFs are even less memory hard for parallel evaluation strategies.

Two issues raised by Alwen and Blocki: Can data- dependence help?

slide-8
SLIDE 8

This paper: Scrypt is optimally memory hard

  • Very first conjectured MHF: Proposed by

Colin Percival in 2009

  • Used within PoWs in Litecoin
  • Inspired the design of Argon2d – one of the

winners of Password Hashing Competition

  • Covered by RFC 7914
slide-9
SLIDE 9

Take home message: Very first example of function with provably optimal memory hardness.

Finding such proof has been a surprisingly hard problem:

  • [Percival, 2009] is incorrect
  • [ACKKPT16] only gave restricted result

+ it is practical, already in use, and relatively simple

No iMHF achieves optimal memory hardness

slide-10
SLIDE 10

Roadmap

1. The Scrypt function

Definition, memory-hardness intuition, and challenges

2. Optimal memory hardness of Scrypt 3. Conclusions

slide-11
SLIDE 11

𝐈 𝐈

Core of Scrypt: ROMix

𝐈

π‘Œ1 π‘Œ2 π‘Œπ‘œβˆ’1 𝐢0 π‘Œ0 𝐢0 𝐒𝐏𝐍𝐣𝐲 π‘Œ0

𝐷0 = 𝐢0 mod π‘œ

𝐢1

𝐷1 = 𝐢1 mod π‘œ

𝐈: A Salsa20 based β€œhash function”

with output length 𝒙.

π‘«πŸ = πŸ‘ π‘«πŸ = 𝒐 βˆ’ 𝟐 input

π‘œ: a tunable parameter.

e.g., π‘œ = 214, π‘₯ = 1 KB Modeled as a random oracle! 𝐢2

𝐷2 π·π‘œβˆ’1

𝐈 𝐈

π‘Œ3

𝐈

π‘Œπ‘œβˆ’2

𝐈 𝐈

𝐢3

𝐷3

𝐈 𝐈

slide-12
SLIDE 12

ROMix: Answering challenges

𝐷0, 𝐷1, … π·π‘œβˆ’1unpredictable challenges:

  • 1. Need to know π‘Œπ·π‘˜ to learn 𝐷

π‘˜+1

  • 2. Need to answer all challenges to

complete the evaluation

Useful to abstract this!

challenge π‘«πŸ π‘«πŸ = π‘œ βˆ’ 1 π‘«πŸ‘ revealed! π‘«π’βˆ’πŸ learnt after answering all π‘«π’Œ

𝐈

π‘Œ1 π‘Œ2 π‘Œπ‘œβˆ’1 𝐢0 π‘Œ0 𝐢0 𝐒𝐏𝐍𝐣𝐲 π‘Œ0 𝐢1

π‘«πŸ = πŸ‘ π‘«πŸ = 𝒐 βˆ’ 𝟐 input

𝐢2

𝐈 𝐈

π‘Œ3

𝐈

π‘Œπ‘œβˆ’2

𝐈 𝐈 𝐈

𝐢3

𝐈

π‘«πŸ’

𝐈

slide-13
SLIDE 13

𝐷

π‘˜ ⟡ {0,1, … , π‘œ βˆ’ 1}

π‘Œπ·π‘˜

Adversary Challenger

For all round π‘˜ = 0, … , π‘œ βˆ’ 1:

Abstraction: Round Game

𝐈 𝐷

π‘˜

π‘Œ0

Adversary’s goal: Reduce its own CMC for answering all challenges! CMC = Cumulative Memory Complexity = σ𝑒=0

π‘ˆ

Memory(𝑒)

𝐈

π‘Œ1 π‘Œ2 π‘Œπ‘œβˆ’1 π‘Œ0

input

𝐈 𝐈

π‘Œ3 π‘Œπ‘œβˆ’2

𝐈

Abstract 2nd phase: challenges are 𝐈-dependent

𝐈

π‘Œ4

random!

slide-14
SLIDE 14

Round game – NaΓ―ve strategy

Init: Mem 0 ← π‘Œ0 for 𝑗 = 1, … , π‘œ do Mem 𝑗 ← 𝐈(Mem 𝑗 βˆ’ 1 ) Upon challenge 𝐷

π‘˜: return Mem[𝐷 π‘˜]

Memory

𝐷0 𝐷1

…

𝐷2 π·π‘œβˆ’1

Θ(π‘œ) Θ(π‘œ Γ— π‘₯)

CMC = Ξ©(π‘œ2π‘₯)

𝐷

π‘˜

π‘Œπ·π‘˜

For round π‘˜ = 0 to π‘œ βˆ’ 1 : remember it!

slide-15
SLIDE 15

Round game – Memory-less strategy

Upon challenge 𝐷

π‘˜:

π‘Œ = π‘Œ0 for 𝑗 = 1, … , 𝐷

π‘˜ do π‘Œ ← 𝐈(π‘Œ)

return π‘Œ

Expected= Θ(π‘œ)

CMC = Ξ©(π‘œ2π‘₯)

𝐷

π‘˜

π‘Œπ·π‘˜

For round π‘˜ = 0 to π‘œ βˆ’ 1 : Memory

𝐷0 𝐷1

…

𝐷2 π·π‘œβˆ’1 𝐷3

again!

slide-16
SLIDE 16

Memory

𝐷0 𝐷1

…

𝐷2 π·π‘œβˆ’1 𝐷3

Memory

𝐷0𝐷1

…

𝐷2 π·π‘œβˆ’1

Previous two strategies are special cases: consistent memory size More general strategy: memory consumption can vary a lot

e.g., forget values, re-compute afterward

π‘«πŸ π‘«πŸ‘ …… Memory π‘«πŸ Time

NaΓ―ve strategy Memory-less strategy CMC = Ξ©(π‘œ2π‘₯) CMC = Ξ©(π‘œ2π‘₯)

Goal: prove CMC = Ξ©(π‘œ2π‘₯)!

large memory at the time a challenge is revealed reduce memory afterward

π‘ˆ

1

π‘ˆπ‘—=time to answer the 𝑗-th challenge

slide-17
SLIDE 17

Memory hardness: intuition

Memory challenge π‘«πŸ‘ π‘«πŸ’

Intuition: Answering challenge fast requires large state!

Time

answer quickly β‡’ large initial state small initial state β‡’ answer slowly

π‘«πŸ“

slide-18
SLIDE 18

Simplifying assumption: upon learning challenge 𝐷

π‘˜,

adversary only stores π‘ž of the values π‘Œ0, … , π‘Œπ‘œβˆ’1

Single-shot memory-time trade-off

Fact: Avg-distance from π‘Œπ·π‘˜ to closest stored π‘Œπ‘— preceding π‘Œπ·π‘˜ is π‘œ/2π‘ž

Expected time to answer the challenge is π‘œ/2π‘ž

π‘Œ0

𝐈

π‘Œ1 π‘Œ2 π‘Œ3 π‘Œ4 π‘Œ5 π‘Œ6 π‘Œ7 π‘Œ8 π‘Œ9

π‘œ = 10, π‘ž = 3 𝐷

π‘˜

dist = 3

Regardless of parallelism, as computation of π‘Œ-values is inherently sequential!

β‰ˆ|memory|

stored

slide-19
SLIDE 19

Three technical barriers:

  • 1. Adversary stores arbitrary information

e.g., XOR of π‘Œπ‘— values, halves of π‘Œπ‘—, reconstruct information adaptively on challenges, etc.

  • 2. Memory variation during computation

single-shot memory-time trade-off not enough!

3.

  • 3. 𝐈-dependent challenges, as opposed to

truly random

How to translate this intuition into a memory- hardness proof for ROMix? Focus on 𝟐 and πŸ‘

[ACKKPT16] considered restricted strategies and exhibited round games where general storing strategies can help! [ACKKPT16] only shows CMC = Ξ©(

π‘œ2π‘₯ log2(π‘œ))

see the paper!

slide-20
SLIDE 20

Roadmap

1. The Scrypt function 2. Optimal memory hardness of Scrypt

Model, theorem, and proof approach

3. Conclusions

slide-21
SLIDE 21

𝑇1 π‘‡π‘ˆ

The parallel random oracle model

𝐈

…

π‘Œ0 𝑍 [Alwen and Serbinenko, STOC ’15] ROMix(π‘Œ0)

At each step: Adv asks one batch of parallel 𝐈 queries + performs unbounded computation

Goal of adv: minimize CMC = σ𝑗=1

π‘ˆ

|𝑇𝑗|

new state initial state

arbitrary computation

𝑇2

𝐈

new state

arbitrary computation

slide-22
SLIDE 22

Main Theorem.

For any adversary A evaluating ROMix, CMC(A) β‰₯

1 25 βˆ™ π‘œ2 βˆ™ (π‘₯ βˆ’ 4 β‹… log(π‘œ))

w/ overwhelming probability over the choice of 𝐈. The 4log(π‘œ) loss is inherent in the proof. Ξ© π‘œ2π‘₯ clearly best possible for any construction making π‘œ queries to 𝐈.

NaΓ―ve strategy: Make π‘œ calls, remember all outputs

slide-23
SLIDE 23

Proof strategy: step 1

Memory-time trade-off β‡’ lower bound on memory

The memory-time trade-off holds true for adv storing π‘Œ-values even if the adv stores arbitrary information!

Memory

challenge 𝑫𝒋 𝑫𝒋+𝟐

π‘ˆπ‘—=time to answer the 𝑗-th challenge Green (memory usage at this step) is inversely proportional to orange (π‘ˆπ‘—)

π‘ˆ

𝑗

β‰₯ Ξ©(π‘œπ‘₯)

slide-24
SLIDE 24

𝐡𝐈( , 𝐷)

π‘Ž π‘ˆ steps

recover π‘Œπ· π‘Ž: arbitrary computation on 𝐈-outputs

  • E.g., pre-computation of πˆβ€™s entries,

XOR of {π‘Œπ‘—} values, halves of π‘Œπ‘— Goal: Lower bound |π‘Ž| as function of π‘ˆ and π‘œ

Single-shot memory-time trade-off

state

[This result]: computation on 𝐈-outputs cannot help for Scrypt!

𝐷

𝐈

π‘Œ1 π‘Œ2 π‘Œπ‘œβˆ’1 π‘Œ0

input

𝐈 𝐈

π‘Œ3 π‘Œπ‘œβˆ’2

𝐈 𝐈

π‘Œ4

[ACKKPT16]: computation on 𝐈-outputs can help in some round games

𝐷

slide-25
SLIDE 25

π‘Ž π‘ˆ steps

recover π‘Œπ·

𝐡𝐈( , 𝐷)

  • Lemma. For all 𝐡, for most 𝐈, if π‘Ž β‰ˆ π‘žπ‘₯ bits

Pr

𝐷

π‘ˆ > π‘œ 2π‘ž > 1 2

𝐷

𝐈

π‘Œ1 π‘Œ2 π‘Œπ‘œβˆ’1 π‘Œ0

input

𝐈 𝐈

π‘Œ3 π‘Œπ‘œβˆ’2

𝐈 𝐈

π‘Œ4

Single-shot memory-time trade-off

slide-26
SLIDE 26

If adversary 𝐡𝐈(π‘Ž, 𝐷) answers too fast for most challenges 𝐷

Cannot be true for too many H: random oracle is incompressible

[Dwork, Naor and Wee, Crypto’05], [Alwen and Serbinenko, STOC ’15]

  • Lemma. For all 𝐡, for most 𝐈, if π‘Ž β‰ˆ π‘žπ‘₯ bits

Pr

𝐷

π‘ˆ > π‘œ 2π‘ž > 1 2

Proof idea:

Can compress the oracle 𝐈 using state π‘Ž 𝐡𝐈(π‘Ž, 𝐷) can output or query many π‘Œπ‘— values w/o querying 𝐈 first

slide-27
SLIDE 27

Technical barriers:

  • 1. Adversary stores arbitrary information

Single-shot memory-time trade-off for arbitrary adv

  • 2. Memory variation during computation

Single-shot memory-time trade-off Optimal CMC lower bound for the round game

Proof strategy: step 2

Generalize

slide-28
SLIDE 28

CMC lower bound

Memory π‘«πŸ π‘«πŸ π‘«πŸ‘ π‘«πŸ’ π‘«πŸ“ π‘«πŸ”

  • Lemma. Pr

𝐷

π‘ž >

π‘œ 2π‘ˆ > 1 2 when learning the 𝑗-th challenge |memory| β‰₯

π‘œπ‘₯ 2π‘ˆπ‘—

π‘ˆ

𝑗=time to answer the 𝑗-th

challenge

CMC = ???

π‘ˆ

3

π‘ˆ

5

π‘ˆ

1

π‘ˆ

4

π‘ˆ

2

memory-time trade-off β‡’ memory lower bound for the step right before the challenge is revealed

Time

General strategy

π‘ˆ no lower bound at this step

slide-29
SLIDE 29

CMC lower bound

Memory π‘«πŸ π‘«πŸ π‘«πŸ‘ π‘«πŸ’ π‘«πŸ“ π‘«πŸ”

  • Lemma. Pr

𝐷

π‘ž >

π‘œ 2π‘ˆ > 1 2

Similar trade-off holds for every step before challenge is revealed

mem at every step β‰₯ funcs of 𝒐 and time to answer the next challenge π‘ˆ

𝑗=time to answer the 𝑗-th

challenge π‘ˆ

2

General strategy

Time

Green inversely proportional to

  • range
slide-30
SLIDE 30

CMC lower bound

Memory π‘«πŸ π‘«πŸ π‘«πŸ‘ π‘«πŸ’ π‘«πŸ“ π‘«πŸ”

  • Lemma. Pr

𝐷

π‘ž >

π‘œ 2π‘ˆ > 1 2

By adding lower bounds over rounds from 0 to π‘œ βˆ’ 1, we have CMC = Ξ©(π‘œ2π‘₯)

During round 𝑗 βˆ’ 1: Sum of memory β‰₯

π‘œπ‘₯ 2 ln 1 + π‘ˆπ‘—βˆ’1 π‘ˆπ‘—

π‘ˆ

𝑗=time to answer the 𝑗-th

challenge = Ξ©(π‘œ2π‘₯)

General strategy

𝑗 = 2

π‘ˆ

1

π‘ˆ

2

Time

slide-31
SLIDE 31

Roadmap

1. The Scrypt function 2. Optimal memory hardness of Scrypt 3. Conclusions

slide-32
SLIDE 32

Summary

  • Scrypt is maximally memory hard

– First optimal memory-hardness proof. – Validates a practical MHF design.

  • Open problem

– Optimal memory hardness proof for Argon2d?

slide-33
SLIDE 33

Thank you! – Merci!

https://eprint.iacr.org/2016/989