Take the 2-minute tour ×
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.

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.

Example:
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
2  
Define better and I'll define base 64 :) –  owlstead May 26 at 23:15
    
@owlstead Define what better? –  Noah Geren May 26 at 23:23
    
I mean, define "better"? Readability? Compactness? Less digits, more letters? –  owlstead May 26 at 23:24
    
A standard of which rsa results are written. Whatever that may be –  Noah Geren May 26 at 23:26
    
Ah, yes, I've given you base 64, see :) –  owlstead May 26 at 23:35

1 Answer 1

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

 
discard

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.