• Advertisement
Sign in to follow this  

RSA message limitation (with C++ source code)

This topic is 744 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement

I read somewhere that if used incorrectly, RSA has the security of the lowly Caesar cipher. To get around this, one is supposed to add a pad of (pseudo-)random numbers to the message. Do you put the pad at the beginning of the message, or at the end? Or both?

Edited by taby

Share this post


Link to post
Share on other sites

Is it a good idea to make the encryption key e large?

 

What I mean to ask is:

6831636268916828328318892898989685198399119653965311896986632969623229621083238916933629968153681965328969839888866484783

 

better than:

17?

 

Both primes p and q are two-hundred digits in length (much larger than e).

Edited by taby

Share this post


Link to post
Share on other sites
I am not aware of an attack that could exploit e being a small number. But what's wrong with making e be a random number between 0 and p*q? Technically you would have to verify that you didn't pick a multiple of p or q, but let's not worry about things that will not happen. :) Edited by Álvaro

Share this post


Link to post
Share on other sites

The two books I have bought recently were "Applied Cryptography" by Bruce Schneier and "Mastering Algorithms with C" by Kyle Loudon. Both books say that e must be coprime with (p - 1)(q - 1). Same with https://en.wikipedia.org/wiki/RSA_(cryptosystem)#Key_generation

 

Yeah, I made that large e by somewhat randomly banging on the keyboard.  :)

 

In the end I used e = 65537. I tried 65536 for fun, and the program died with a segfault LOL (I'm using someone else's bigint library).

 

I didn't do the optimal padding; I used 512 pseudorandom bits to salt the message before encryption. I didn't use a cryptographic-quality pseudorandom number generator.

 

... so there is room for improvement.

Edited by taby

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement