JoΓ«l Alwen IST Austria Krzysztof Pietrzak IST Austria Leonid Reyzin Boston University Stefano Tessaro UCSB Binyi Chen UCSB
Memory Hard Jol Alwen Binyi Chen IST Austria UCSB Krzysztof - - PowerPoint PPT Presentation
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
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
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
Memory-hard functions (MHFs)[Percival, 2009]
Fast evaluation of MHF F β large memory Small memory β slow evaluation of MHF F
π
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
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?
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?
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
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
Roadmap
1. The Scrypt function
Definition, memory-hardness intuition, and challenges
2. Optimal memory hardness of Scrypt 3. Conclusions
π π
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
π π
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
π
π«π
π
π·
π β΅ {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!
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!
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!
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
Memory hardness: intuition
Memory challenge π«π π«π
Intuition: Answering challenge fast requires large state!
Time
answer quickly β large initial state small initial state β answer slowly
π«π
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
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!
Roadmap
1. The Scrypt function 2. Optimal memory hardness of Scrypt
Model, theorem, and proof approach
3. Conclusions
π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
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
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 (ππ)
π
π
β₯ Ξ©(ππ₯)
π΅π( , π·)
π π 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
π·
π π 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
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
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
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
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
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
Roadmap
1. The Scrypt function 2. Optimal memory hardness of Scrypt 3. Conclusions
Summary
- Scrypt is maximally memory hard
β First optimal memory-hardness proof. β Validates a practical MHF design.
- Open problem