0

I just started studying Information Security, but I just ran this program:

http://www.sanfoundry.com/cpp-program-implement-rsa-algorithm/

and faced this strange thing. For small keys (don't try to run it for huge primes, it doesn't give good output), like 211 and 223, inputting a string like 1122 gives output of type aabb, because first two symbols are the same and last two symbols as well. Is it how RSA works? I was pretty sure it mixes the bits up.

1 Answer 1

7

Single, unpadded input chars
That implementation you linked operates on individual characters. So patterns are repeated.

Also these characters are not padded in any way. Padding would prevent such easily spotted patterns.

Not the real thing
So this is somewhat RSA like. But it is not actual RSA. (Because PKCS#1 mandates padding.) Wikipedia calls this "Plain RSA". Another name heard here is "Textbook RSA".

Further reading

3
  • Thank you, cannot upvote though, too little reputation.
    – James Pond
    May 18, 2015 at 22:02
  • Or "raw RSA". Raw RSA is just modular exponentiation, it's not secure at all, there are at least 10 attacks or so. That it is fully deterministic - i.e. always encrypts to the same value - is just one. May 18, 2015 at 23:13
  • @JamesPond You can accept though (grey mark next to the answer). If you are not sure you can wait a while before doing so. May 18, 2015 at 23:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .