1
$\begingroup$

I am trying to encrypt the word Hello using RSA. When encrypting Hello’s integer representation, is each letter encrypted separately, or is the whole thing encrypted? Furthermore, am I correct in assuming that Hello is to be represented in binary form for RSA encryption?

$\endgroup$
  • 4
    $\begingroup$ In practice: neither. 'Hello' is not encrypted with RSA at all, but with a symmetric cipher, the key of which is then RSA encrypted. $\endgroup$ – otus Nov 2 '15 at 8:14
3
$\begingroup$

For the purposes of your high school project, I suppose either one is fine. As you mentioned, one possibility is to convert the message to a bit-string using ASCII, and then interpret the bitstring as an integer and treat it as the message to be encrypted. If you need to "show your work" on paper or slides, then writing it in decimal is reasonable.

However, as @otus mentioned, this method is never used in practice nowadays because it falls short of what we require of modern cryptosystems, for various reasons. You can Google something like "textbook RSA" or "plain RSA" to find out more, and I would suggest that it would be a good idea to at least mention those issues in some way in your project.

$\endgroup$
1
$\begingroup$

I think I found the answer to my own question... First Hello is represented in binary form (ASCII). After that, the integer in binary form is converted to decimal form.

$\endgroup$
  • $\begingroup$ 'Hello'.encode('hex') = '48656c6c6f' and so int('48656c6c6f', 16)=310939249775 $\endgroup$ – Lisbeth Jan 9 '16 at 10:41
  • 1
    $\begingroup$ I know from experience that one can get away with this approach in a high school project and still get the highest grade. In practice it is insecure and breaks down for larger messages. For those reasons practical implementations combine it with a symmetric algorithm such as AES combined with a suitable encryption mode. $\endgroup$ – kasperd Jan 9 '16 at 15:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.