Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have created a RSA encryption/decryption program but how do i write out the results after doing a encryption? Right now I have it so that it will just print out the decimal value of one character after encrypting then a space and the next value.


Public Key: (143, 17)  
Message: hello  
Encrypted:  91 95 114 114 89  

Is there a better way of writing this encrypted text?

share|improve this question

You are showing "textbook" RSA, which is not used in practice. In practice RSA is defined within PKCS#1, defined in RFC 3447. The output is converted from a positive integer to an octet string (or byte array) using I2OSP.

Note that RSA is almost never used to directly encrypt text or characters. Normally hybrid encryption is used. Whatever algorithm, scheme or protocol is used, modern cryptography mostly takes bytes as input and generates bytes as output. The input and output may possibly be decoded and encoded, with base 64 being the most common method of encoding.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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