top of page

Creating public and private keys in RSA algorithm :

 

1.- First chose two prime numbers p and q :

 

For example p = 3 and q = 5

 

2.- Calculate n = p·q

 

n = 15

 

3.- Calculate fi(n) = (p-1)(q-1) = 2·4 = 8 (number of primes less than n , including 1 )

 

4.- Chose e with the conditions : 1 < e < fi(n) and gcd (e, fi(n) ) = 1

 

 

For example e = 7

 

5.- Solve the equation eX + fi(n) Y = 1 by trial and error

 

 

7X + 8Y = 1 X = 15 Y = -13      So    d = X = 15

 

6.- Keys :

​

      Public key (e, n ) = (7, 15)

 

      Private key (d,n )= (15, 15)

​

A  B  C  D  E  F  G  H  I  J   K   L   M   N   O  P   Q   R   S   T   U   V  W   X   Y   Z

0   1  2    3  4  5   6   7  8  9 10  11  12   13 14 15 16  17  18  19 20  21 22   23 24  25

bottom of page