The following example clearly demonstrates the RSA encryption algorithm:
Encrypt and decrypt the message "CAB" by the RSA algorithm. For simplicity, take small numbers - this will reduce our calculations.
* Выберем p=3 and q=11. * Определим n= 3*11=33. * Hайдем (p-1)*(q-1)=20. Следовательно, d будет равно, например, 3: (d=3). * Выберем число е по следующей формуле: (e*3) mod 20=1. Значит е будет равно, например, 7: (e=7). * Представим шифруемое сообщение как последовательность чисел в диапозоне от 0 до 32 (незабывайте, что кончается на n-1). Буква А =1, В=2, С=3.
Now encrypt the message using the public key {7.33}
C1 = (3^7) mod 33 = 2187 mod 33 = 9; C2 = (1^7) mod 33 = 1 mod 33 = 1; C3 = (2^7) mod 33 = 128 mod 33 = 29;
Now decrypt the data using the private key {3.33}.
M1=(9^3) mod 33 =729 mod 33 = 3(С); M2=(1^3) mod 33 =1 mod 33 = 1(А); M3=(29^3) mod 33 = 24389 mod 33 = 2(В);
Here I am interested in this moment:
Choose a number e by the following formula: (e 3) mod 20 = 1. We define the number e for which the following relation is true (e d) mod ((p-1) * (q-1)) = 1.
How is this number chosen? At random? Or, nevertheless, can we somehow bring in mind е=
?