Implementation of RSA encryption algorithm in JavaScript
0) Let's take two large prime numbers p and q.
Calculate Primes p and q
1) Let us define M as the result of multiplication p on q (M= p*q).
M=p*
q
2) Calculating the Euler function (p-1)*(q-1):
3) Let's choose a random number, which we will call d. This number must be mutually prime (have no common divisor other than 1), with the result of multiplication (p-1)*(q-1).
4) Let's choose a number ะต using the following formula: (e* d) mod (p-1)*(q-1)=1