D
D
d0naLd2014-03-25 08:19:02
Encryption
d0naLd, 2014-03-25 08:19:02

RSA encryption algorithm - how does the mod function work?

Good day!
I'm trying to figure out how the mod function works.
Until today, I thought that the answer type A mod B in the answer should give the remainder of the separation of A by B.
Today I came across an example in a tutorial on encryption:
"First, I chose two prime numbers. In this case, the numbers p = 11 and q were chosen = 13.
Now we calculate n = pq We have n = 11 * 13 = 143.
Now we need to calculate f(n) = (p - 1)(q - 1) = (11 - 1)(13 - 1) = 10 * 12 = 120.
We choose the number e so that it is prime with respect to φ(n), here the value e = 7 was chosen.
It is necessary to define d such that (d)(e) = 1 mod φ(n). Therefore, (d)(7) = 1 mod 120 ; d must also be less than 120. We find that d = 103. (103 multiplied by 7 gives 721. 721 divided by 120 gives 6 with a remainder of 1.)
Secret key: {103, 143}.
Public key: {7, 143}.
Suppose we want to send the message "9". Using the encryption formula, we get the following:
Ciphertext = (9)7 mod 143 = 48.
When encrypted information is received, it is processed by the decryption algorithm:
Plaintext = (48)103 mod 143 = 9. "

I have two questions:
Why (d )(7) = 1 mod 120 if the remainder of dividing 1 by 120 is 1?
And how does the mod function work in this example here (9)7 mod 143 = 48. and here (48)103 mod 143 = 9?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
Brand, 2014-03-25
@d0naLd

The notation "A = B mod C" is identical to the notation "B is the remainder of dividing A by C".
"A mod B in the answer must give the remainder of the separation of A by B" - a holdover from Pascal)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question