Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Finding the multiplicative inverse using the extended Euclids algorithm For example: Find the inverse of e = 17 for

RSA where p = 101 and q = 199 Calculate t = (101 - 1)*(199 - 1) = 19800 So the inverse d should satisfy the following: e*d mod t = 1. Substituting, 17 * d mod 19800 = 1 Finding d using the extended Euclids algorithm. Setup a table as shown below, the U & V values are always setup in this way. Row Quotient Remainder U V 0 19800 0 1 1 17 1 0 2 3 4 5 Start to fill in the empty spaces. 19800 / 17 1164 times, remainder 12 (see where to put values below) Row 0 1 2 3 4 5 Quotient 1164 Remainder U V 19800 0 1 17 1 0 12

To get the values under U & V, follow this pattern: (a) (b) (c) (d) 0 - (1164 * 1) = -1164 In other words, 0 (1164 * 1) = -1164. Row 0 1 2 3 4 5 Quotient 1164 (b) Remainder 19800 17 12 U V 0 (a) 1 1 (c) 0 -1164 (d)

Do the same for the V value. Row 0 1 2 3 4 5 Quotient 1164 (b) Remainder 19800 17 12 U 0 1 -1164 V 1 (a) 0 (c) 1 (d)

That is, 1 (1164 * 0) = 1. Continue for the remainder of the table. For each row as you go down, use the next values of U & V to do your calculations. E.g. if the last calculation used row 0, the next calculation uses row 1 and so on. Row 0 1 2 3 4 5 Quotient 1164 1 2 2 Remainder 19800 17 12 5 2 1 U 0 1 -1164 1165 -3494 8153 V 1 0 1 -1 3 -7

When the remainder gets to 1, the calculation is complete (last row). The value highlighted above is the inverse of e. CHECK: 17 * 8153 mod 19800 = 1

You might also like