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