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.

This question already has an answer here:

According to http://en.wikipedia.org/wiki/RSA_%28algorithm%29#Key_generation the key length is the number of bits in n. So how can a message of many megabytes (millions of bits) be modded by a 1024 bit n? I never hear of a block mode for RSA, for instance.

share|improve this question

marked as duplicate by Gilles, Maeher, owlstead, Hendrik Brummermann Jul 10 '13 at 22:16

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
The title of your question asks about encoding text as a number. Text in a computer is already encoded as a series of numbers we call bytes. The encoding varies, but common encodings are ASCII, Unicode UTF-8, etc. We simply place the bytes next to each other in an array, and they can be treated as a big number, just like placing digits 1, 2, and 3 next to each other makes a bigger number of 123. We don't care if the big number has a numerical meaning, because we're just going to re-encode it back to ASCII after decrypting anyway. –  John Deters Jun 5 '13 at 0:03
    
@Gilles Agreed. It is a duplicate. That's really what I meant to ask, but I phrased it differently. I couldn't find it when I searched. Do I delete my question? I'm not sure the etiquette here. –  Roman Zabicki Jun 9 '13 at 18:50
    
@RomanZabicki No, don't delete your question, it's useful for other people who will phrase their question like you rather than like the other asker. Once a few more people vote to close, your question will look like this. –  Gilles Jun 9 '13 at 18:57
add comment

1 Answer 1

up vote 2 down vote accepted

You never use RSA to encrypt large binary objects, since it's to expensive to do many calculations.

Instead, RSA is used in a key exchange or key transport protocol to send a key for a symmetric-key algorithm, such as AES (with a cipher chaining mode, such as CBC), which is then used to encrypt huge messages.

Also note that textbook RSA isn't secure. Some differences between textbook RSA and deployed RSA are mentioned there: http://crypto.stackexchange.com/a/1449/4874

share|improve this answer
add comment

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