rsa implementation question
heikowu at ceosg.de
Wed Aug 11 08:52:57 CEST 2004
Am Mittwoch, 11. August 2004 07:08 schrieb Ajay:
> just like to know how the RSA implementation in the pcrypto package works.
> Does it operate in blocks, if yes, what is the size of the blocks?
RSA (Rivest-Shamir-Adleman encryption) never works in "blocks", as there is no
notion of blocks in public key cryptography, there's only the notion of doing
an operation on plaintext modulo a large prime n.
Now, you could call (log2 n)/8 the block size in bytes of RSA for a certain
encryption prime, but I'd never talk of block sizes with RSA, as normally you
don't use RSA (or public-key cryptography in general) to encrypt plaintext a
block at a time, but rather to encrypt a random string of bytes [len(s) <=
(log2 n)/8 for the modulo prime of the algorithm], which is used as the key
for a normal symmetric encryption algorithm, to which you feed the blocks.
Thus, the receiver (and also the sender) only has to make one expensive
calculation (retrieving the key from the encrypted RSA packet), whereas
decrypting the cyphertext (or encrypting it) is done using a symmetric
cypher, which has the advantage of being much faster to compute than a
Anyway, if you're interested in how symmetric and/or public-key cryptography
work, read up on:
especially chapters 7 and 8.
More information about the Python-list