Score:0

RSA - encrypted plaintext results in the same ciphertext value

cn flag

Just started learning about RSA cryptography so forgive me if I made any mistakes or misunderstandings.

M = 20 be the message that i want to encrypt

N = 5*7 , p = 5 and q = 7

φ(N) = (5-1)(7-1) = 24

Let e = 5 as it is a coprime of 24

To encrypt the message, E = M^e mod(N)

This works out to E = 20^5mod35 , which equates to 20 as well

I have tried other values of e but the ciphertext is always 20. Is there anything wrong with having the plaintext and ciphertext being the same?

Richie Frame avatar
cn flag
What you are learning with is called "textbook rsa" and with very small numbers, which is not cryptographic rsa, which uses VERY large numbers and additional functions to make 2 identical plaintexts produce different ciphertexts, see https://crypto.stackexchange.com/questions/1448/definition-of-textbook-rsa
kelalaka avatar
in flag
Opposite of [Why are RSA ciphertexts different for the same plaintext?](https://crypto.stackexchange.com/q/26249/18298)
us flag
RSA goes with messages M<N
Score:3
my flag

Is there anything wrong with having the plaintext and ciphertext being the same?

What you're seeing is an artifact of your choice of plaintext (which is made rather more likely because of your tiny modulus).

We have $20^e \equiv 20 \pmod{35}$ for any odd $e$; this happens because:

$20 \equiv 0 \pmod 5$, and so $20^e \equiv 20 \pmod 5$ always

$20 \equiv -1 \pmod 7$, and so $20^e \equiv 20 \pmod 7$ for any odd $e$.

The above two (along with the similar $m \equiv 1 \pmod p$) are simultaneously true for both prime factors for 9 different ciphertexts; it's just that when you start with 35 possible ciphertexts, picking one of the unlikely 9 isn't that much of a coincidence.

For 35, the 9 values of $m$ for which $m^e=m$ are true are: 0, 1, 6, 14, 15, 20, 21, 29, 34.

Tiny modulii show other artifacts as well (such as the public and private exponents being the same often); that can be misleading if you are attempting to learn RSA by examining their behavior.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.