Generate cipher code
Step 1 Choose two coprime number randomly
53
and 271
The bigger these number is the more difficulty to break it.
Step 2 First number multiplied by second number
totle 14bits
In daily application use 1024 bits[128bytes] usually.
In some important application use 2048 bits[256bytes] usually.
Step 3 Calculate n’s Euler function
Step 4 Choose a number e
and the number e
has coprime relation with
Choose between (1, 14040), suppose 97
as e
;
Step 5 Calculate mod inverse element
Calculate the mod inverse element d
for e
with
->
->
->
Based on Extended Euclidean algorithm
x = -4487, y = 31 -> (-4487, 31) is a solution pair
positive d
(-4487, 31) -> (9553, -66)
Step 6 Packaging
Pack n
and e
into public key,n
and d
into private key
n = 14040 e = 97 d = 9953 and k = -66
So , (14363, 97) is public key, (14363, 9553) is private key.