Fast Arithmetic Modulo 2๐ฆ๐๐ง ยฑ 1
Joppe W. Bos and Simon Friedberger
2 1 Joppe W. Bos and Simon Friedberger Why these strange primes? - - PowerPoint PPT Presentation
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
Joppe W. Bos and Simon Friedberger
๏ด Quantum computers ๏ด NIST call for PQC standards [1] [2]
2
๏ด 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!
3
ECC ๐ ๐ = ๐ SIDH ๐น2 = ฮฆ๐ โ โฏ โ ฮฆ1(๐น1)
[3] [3]
4
[3]
5
6
6
๏ด Montgomery reduction ๏ด Barrett division ๏ด Modular simplification ๏ด Shifting ๏ด Special radix ๏ด โฆ
7
๏ด Calculate ฮค เทค ๐เทจ ๐ ๐ = ๐๐๐ ๐๐๐ ๐ ๏ด Montgomery multiplication
๐๐โ1 = ๐ + ๐๐๐ ๐๐๐ ๐ ๐ /๐ (๐๐๐ ๐)
๏ด Prime shape optimizations: ๏ด ๐ = โ๐โ1 โก 1 for ๐ โก ยฑ1 ๏ด ๐ฆ๐ = ๐ฆ 2๐ฆ๐๐ง ยฑ 1 = ๐ฆ๐๐ง 2๐ฆ ยฑ ๐ฆ ๏ด Costs ๐2 + ๐ optimized to ๐2
2 M
8
๏ด Calculate ฮค เทค ๐เทจ ๐ ๐ = ๐๐๐ ๐๐๐ ๐ ๏ด Montgomery multiplication
๐๐โ1 = ๐ + ๐๐๐ ๐๐๐ ๐ ๐ /๐ (๐๐๐ ๐)
๏ด Prime shape optimizations: ๏ด ๐ = โ๐โ1 โก 1 for ๐ โก ยฑ1 ๏ด ๐ฆ๐ = ๐ฆ 2๐ฆ๐๐ง ยฑ 1 = ๐ฆ๐๐ง 2๐ฆ ยฑ ๐ฆ ๏ด Costs ๐2 + ๐ optimized to ๐2
2 M
9
๏ด Calculate ฮค เทค ๐เทจ ๐ ๐ = ๐๐๐ ๐๐๐ ๐ ๏ด Montgomery multiplication
๐๐โ1 = ๐ + ๐๐๐ ๐๐๐ ๐ ๐ /๐ (๐๐๐ ๐)
๏ด Prime shape optimizations: ๏ด ๐ = โ๐โ1 โก 1 for ๐ โก ยฑ1 ๏ด ๐ฆ๐ = ๐ฆ 2๐ฆ๐๐ง ยฑ 1 = ๐ฆ๐๐ง 2๐ฆ ยฑ ๐ฆ ๏ด Costs ๐2 + ๐ optimized to ๐2
2 M
10
๏ด Calculate ๐ ๐๐๐ ๐ as ๐ โ ๐/๐ ๐ ๏ด Approximate
๐ ๐ as ๐ ๐ ๐ ๐
๏ด 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 ๐
11
๏ด Calculate ๐ ๐๐๐ ๐ as ๐ โ ๐/๐ ๐ ๏ด Approximate
๐ ๐ as ๐ ๐ ๐ ๐
๏ด 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 ๐
12
๏ด Pick ๐ = ๐ + 1 = 2๐ฆ๐๐ง ๏ด ๐ = ๐1๐ + ๐0 = ๐1๐ + ๐1 + ๐0 โก ๐1 + ๐0 ๏ด Need to divide ๐
๐ and suppose ๐ = 2๐ฆ๐โฒ
๏ด Idea: Use Barrett division with special modulus ๏ด If ๐ = ๐1
โฒ2๐ฆ + ๐0 โฒ and ๐1 โฒ = ๐ฃ๐โฒ + ๐ค it follows that
๏ด ๐ = ๐ฃ2๐ฆ๐โฒ + ๐ค2๐ฆ + ๐0โฒ ๏ด It follows that ๐ค2๐ฆ + ๐0
โฒ = ๐0 and ๐ฃ = ๐1
๏ด Cost โฌ
3 2 ๐, 1 2 ๐ = 5 8 ๐2 + 13 4 ๐ + 1 ๐
13
๏ด 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 ๐
14
๏ด Interleave multiplication and reduction
๏ด Uses less memory
๏ด Multiply and reduce separately
๏ด Allows asymptotically fast multiplication algorithms
๏ด SIDH: Arithmetic in ๐พq2
๏ด (๐ + ๐๐)(๐ + ๐๐) ๏ด 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
15
๏ด 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
16
17
(Costs for multiplication and reduction)
18
(Costs for reduction only)
๏ด 23723239 โ 1 ๏ด 23723239 has 372 zero bits ๏ด 5 words of 64 bit and another 52 bits ๏ด 3239 fits into 6 words but it actually uses 7 now ๏ด We can properly align the powers of three ๏ด Costs: several shifts by 52 bits
19
๏ด Conditions for our search
20
Prime Security ๐๐๐๐๐๐๐๐ โ ๐ 120 23945154 + 1 119 23945155 โ 1 120 23967131 + 1 123 23931791 + 1 124 ๐๐๐๐๐๐๐๐ โ ๐ 125
21
22
https://github.com/sidh-arith/
23
may-be-just-around-the-corner/
computer/?_r=0
long-live-elliptic-curves/
24