Fast Arithmetic Modulo 2 π¦ π π§ Β± 1 Joppe W. Bos and Simon Friedberger
Why these strange primes? 2 ο΄ Quantum computers ο΄ NIST call for PQC standards [1] [2]
Post-Quantum Cryptography 3 ο΄ Lattice-based ο΄ Code-based ο΄ MQ-based ο΄ Hash-based ο΄ Isogeny-based ο΄ Little data (330 B / 10 x smaller) ο΄ Very slow (1000 x slower) ο΄ Requires more cryptanalysis (published 2011) ο΄ β¦but it has elliptic curves!
ECC vs SIDH 4 ECC π π = π SIDH πΉ 2 = Ξ¦ π β β― β Ξ¦ 1 (πΉ 1 ) [3] [3]
Key exchange 5 [3]
Fast Arithmethic modulo 2 π¦ π π§ Β± 1 6 #E(πΎ q 2 ) = 2 π¦ π π§ 2 q = 2 x p y Β± 1
Fast Arithmethic modulo 2 π¦ π π§ Β± 1 6 #E(πΎ q 2 ) = 2 π¦ π π§ 2 q = 2 x p y Β± 1
Compared approaches 7 ο΄ Montgomery reduction ο΄ Barrett division ο΄ Modular simplification ο΄ Shifting ο΄ Special radix ο΄ β¦
Montgomery reduction 8 ο΄ Calculate πΰ·¨ Ξ€ ΰ·€ π π = πππ πππ π ο΄ Montgomery multiplication ππ β1 = π + πππ πππ π π /π (πππ π) ο΄ Prime shape optimizations: ο΄ π = βπ β1 β‘ 1 for π β‘ Β±1 ο΄ π¦π = π¦ 2 π¦ π π§ Β± 1 = π¦π π§ 2 π¦ Β± π¦ ο΄ Costs π 2 + π optimized to π 2 2 M
Montgomery reduction 9 ο΄ Calculate πΰ·¨ Ξ€ ΰ·€ π π = πππ πππ π ο΄ Montgomery multiplication ππ β1 = π + πππ πππ π π /π (πππ π) ο΄ Prime shape optimizations: ο΄ π = βπ β1 β‘ 1 for π β‘ Β±1 ο΄ π¦π = π¦ 2 π¦ π π§ Β± 1 = π¦π π§ 2 π¦ Β± π¦ ο΄ Costs π 2 + π optimized to π 2 2 M
Montgomery reduction 10 ο΄ Calculate πΰ·¨ Ξ€ ΰ·€ π π = πππ πππ π ο΄ Montgomery multiplication ππ β1 = π + πππ πππ π π /π (πππ π) ο΄ Prime shape optimizations: ο΄ π = βπ β1 β‘ 1 for π β‘ Β±1 ο΄ π¦π = π¦ 2 π¦ π π§ Β± 1 = π¦π π§ 2 π¦ Β± π¦ ο΄ Costs π 2 + π optimized to π 2 2 M
Barrett division 11 ο΄ Calculate π πππ π as π β π/π π π as π π π ο΄ Approximate π π ο΄ Error of at most π , or at most 3π after some more optimizations ο΄ Also gives the fraction not just the remainder ο΄ Costs π 2 + 4π + 1 optimized to 5 8 π 2 + 13 4 π + 1 π
Barrett division 12 ο΄ Calculate π πππ π as π β π/π π π as π π π ο΄ Approximate π π ο΄ Error of at most π , or at most 3π after some more optimizations ο΄ Also gives the fraction not just the remainder ο΄ Costs π 2 + 4π + 1 optimized to 5 8 π 2 + 13 4 π + 1 π
Simplified Modulus 13 ο΄ Pick π = π + 1 = 2 π¦ π π§ ο΄ π = π 1 π + π 0 = π 1 π + π 1 + π 0 β‘ π 1 + π 0 ο΄ Need to divide π π and suppose π = 2 π¦ πβ² ο΄ Idea: Use Barrett division with special modulus β² and π 1 β² 2 π¦ + π 0 β² = π£πβ² + π€ it follows that ο΄ If π = π 1 ο΄ π = π£2 π¦ πβ² + π€2 π¦ + π 0 β² ο΄ It follows that π€2 π¦ + π 0 β² = π 0 and π£ = π 1 3 1 5 8 π 2 + 13 ο΄ Cost β¬ 2 π, 2 π = 4 π + 1 π
Folding 14 ο΄ Save time on the reduction by computing a multiplication first ο΄ With precomputed π = π πππ π ο΄ Transform π = π 1 π + π 0 it is clear that π β‘ π 1 π + π 0 πππ π ο΄ Picking π appropriately will reduce the size of the number to reduce ο΄ Costs: For π 1.5 times as long as π we get ο΄ π is reduced in length by 25 % ο΄ Cost π 2 2 π ο΄ Folding + Barrett Cost π 2 2 + 5 4 π + 1 π
Interleaved vs Non-interleaved 15 ο΄ Interleave multiplication and reduction ο΄ Uses less memory ο΄ Multiply and reduce separately ο΄ Allows asymptotically fast multiplication algorithms ο΄ SIDH: Arithmetic in πΎ q 2 ο΄ (π + ππ)(π + ππ) ο΄ Interleaved: 4 M&R, Non-interleaved: 4 M + 2 R ο΄ Using Karatsuba: 3 M&R vs 3 M + 2 R ο΄ Non-interleaved is to be preferred for SIDH
Modulus based Radix 16 ο΄ Recent approach from WAIFI ο΄ Pick π = π and representation π = π 1 π + π 0 this gives ο΄ ππ = π 1 π 1 π 2 + (π 1 π 0 + π 0 π 1 )π + π 0 π 0 = π 1 π 0 + π 0 π 1 π + π 1 π 1 + π 0 π 0 ο΄ Reduce both parts again using Barrett division ο΄ Costs: 17 16 π 2 + 13 4 π + 2 π ο΄ Unfortunately interleaved
Results (interleaved) 17 (Costs for multiplication and reduction)
Results (non-interleaved) 18 (Costs for reduction only)
Shifting 19 ο΄ 2 372 3 239 β 1 ο΄ 2 372 3 239 has 372 zero bits ο΄ 5 words of 64 bit and another 52 bits ο΄ 3 239 fits into 6 words but it actually uses 7 now ο΄ We can properly align the powers of three ο΄ Costs: several shifts by 52 bits
SIDH friendly primes 20 ο΄ Conditions for our search 1. π β 3,5,7,11,13,17,19 2. 384 β€ π¦ < 450 and 2 300 < π π§ < 2 450 3. 2 740 < 2 π¦ π π§ Β± 1 < 2 768 4. 2 π¦ β π π§ < 2 40 5. 2 π¦ π π§ + 1 or 2 π¦ π π§ β 1 is prime
New prime suggestions 21 Prime Security π πππ π πππ β π 120 2 394 5 154 + 1 119 2 394 5 155 β 1 120 2 396 7 131 + 1 123 2 393 17 91 + 1 124 π πππ ππ ππ β π 125
Benchmarking results 22
Questions? 23 https://github.com/sidh-arith/
References 24 1. https://www.technologyreview.com/s/602283/googles-quantum-dream- may-be-just-around-the-corner/ 2. https://bits.blogs.nytimes.com/2013/05/16/google-buys-a-quantum- computer/?_r=0 3. https://www.esat.kuleuven.be/cosic/elliptic-curves-are-quantum-dead- long-live-elliptic-curves/
Recommend
More recommend