Download presentation
Presentation is loading. Please wait.
1
Fast Modular Exponentiation
Viny Christanti M., M.Kom
2
Modular Exponentiation
Modular Exponentiation is a type of exponentiation performed over a modulus. A = xn mod p Solusi: Modular multiply Modular square and multiply Modular reduction
3
Kegunaan Implementasi perhitungan RSA sangat membutuhkan modulo exponentiation. Operasi ini harus dapat dilakukan dengan cepat dan tepat. Bagaimana menghitung mod 4559 ? memiliki 3397·4 digits!
4
Modular Addition 7 + 9 = 16 (7 + 9) mod 10 = 6 7 + 4 = 11
? 7 + 9 = 16 (7 + 9) mod 10 = 6 7 + 4 = 11 (7 + 4) mod 10 = 1 5 + 5 = 10 (5 + 5) mod 10 = 0 ? ? ? ? ?
5
Modular Subtraction 7 - 9 = -2 (7 - 9) mod 10 = 8 7 - 4 = 3
? 7 - 9 = -2 (7 - 9) mod 10 = 8 7 - 4 = 3 (7 - 4) mod 10 = 3 5 - 5 = 0 (5 - 5) mod 10 = 0 ? ? ? ? ?
6
Modular Multiplication
? 7 × 9 = 63 (7 × 9) mod 10 = 3 7 × 4 = 28 (7 × 4) mod 10 = 8 5 × 5 = 25 (5 × 5) mod 10 = 5 ? ? ? ? ?
7
Modular Division 7 ÷ 9 = 7/9 (7 ÷ 9) mod 10 = 3
? 7 ÷ 9 = 7/9 (7 ÷ 9) mod 10 = 3 proof: 3 × 9 mod 10 = 7 7 ÷ 4 = 7/4 (7 ÷ 4) mod 10 = ?? undefined: no x such that 4 × x mod 10 = 7 5 ÷ 5 = 1 (5 ÷ 5) mod 10 = ?? undefined: more than one x such that 5 × x mod 10 = 5 ? ? ? ? ?
8
Modular Exponentiation
79 = 7 × 7 × 7 × 7 × 7 × 7 × 7 × 7 × 7 = 40,353,607 79 mod 10 = 7 79 takes four multiplications, and the intermediate values keep getting larger: 72 = 7 × 7 = 49 74 = 72 × 72 = 49 × 49 = 2401 78 = 74 × 74 = 2401 × 2401 = 5,764,801 79 = 78 × 71 = 5,764,801 × 7 = 40,353,607 79 mod 10 takes also four (mod) multiplications, but the values stay small
9
Contoh 1113 mod 53? Jawaban: How ‘bout 2325 mod 30 ?
13 = maka, 1113 = = 118 * 114 * 111 sehingga, 11 mod 53 = 11 112 = 121, 121 mod 53 = 121 – 2*53 = 15 114 = (112 mod 53 )2 = 152 mod 53 = 225 mod 53 = 225 – 4*53 = 13 118 = (114 mod 53 )2 = 132 mod 53 = 169 mod 53 = 169 – 3*53 = 10 1113 mod 53 = 11 * 13 * 10 = mod 53 = 1430 – 26*53 = 52 1113 mod 53 = 52 How ‘bout 2325 mod 30 ?
10
Algoritma Initialise y=1; u=x mod p; Repeat
If n is odd then y:=(y*u) mod p; n:=n div 2; u:=(u*u) mod p; Until n==0; Output y;
11
Contoh 2325 mod 30 Solusi: The previous method of repeated squaring works for any exponent that’s a power of isn’t. However, we can break 25 down as a sum of such powers: 25 = Apply repeated squaring to each part, and multiply the results together. Previous calculation: 238 mod 30 = 2316 mod 30 = mod 30 (mod 30)
12
Contoh 2325 mod 30 … 2325 mod 30 2316+8+1 (mod 30)
Jawaban: mod 30 = 23
13
Contoh 2325 mod 30 … How could we have figured out the decomposition
25 = from the binary (unsigned) representation of 25? 25 = (11001)2 maka 25 = 1·16+1·8+0·4+0·2+1·1 =
14
Selamat Berputar
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.