Online RSA key generation help


Settings Remark
Euler's phi(n) function The Euler's phi(n) function is used to create the private key.

The Euler's phi(n) function is automatically calculated when both prime numbers p and q are available:

phi(n) = (p - 1) * (q - 1)

p = prime number p
q = prime number q
n = modulus (p * q)

The Euler's phi function is defined as follows:
phi(i) = the number of positive integers less than or equal to i that are coprime to i.

Example 1:
phi(8) = 4

Because 8 is coprime to 1, 3, 5 and 7

Example 2:
phi(15) = 8

Because 15 is coprime to 1, 2, 4, 7, 8, 11, 13 and 14


If p is a prime number, then: phi(p) = (p-1)

Example 3:
phi(7) = 6

Because 7 is coprime to 1, 2, 3, 4, 5 and 6

Example 4:
phi(13) = 12

Because 13 is coprime to 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 and 12


If p and q are different prime numbers, then phi(p*q) = (p - 1)*(q - 1)

Example 5:
p=3, q=5
phi(3*5) = (3 - 1)*(5 - 1)
phi(15) = 2*4 = 8

Because 15 is coprime to 1, 2, 4, 7, 8, 11, 13 and 14

Example 6:
p=5, q=7
phi(5*7) = (5 - 1)*(7 - 1)
phi(35) = 4*6 = 24

Because 35 is coprime to 1, 2, 3, 4, 6, 8, 9, 11, 12, 13, 16, 17, 18, 19, 22, 23, 24, 26, 27, 29, 31, 32, 33 and 34