# What type of cipher is RSA?

Is RSA a stream cipher or a block cipher?

-

It is neither a stream cipher nor a block cipher. Both of these use the same key to encrypt and decrypt (symmetric encryption).

RSA is asymmetric meaning you encrypt with a different key than you decrypt with. The advantage is that the encryption key can be made public, since people can only use it to encrypt and no one can decrypt if you keep the decryption key to yourself.

Unlike (generalization) block and stream ciphers, RSA is based directly on mathematics.

-

RSA is a block cipher and can use variable-length block sizes. Simply because it is not symmetric does not mean it can not be a block or stream cipher. Further, while it is not intended to be used as a block cipher, it is nonetheless a block cipher. Confused yet? :)

RSA is typically meant to only encrypt very small pieces of data, typically hashes and symmetric key that are then used to encrypt the majority of the data. However, RSA encryption/decryption works on blocks of data, usually 64 or 128 bits at a time. The size of the blocks is determined at run time. Since the requisite data can often be en(de)crypted in a single use, it is often mistakenly assumed that it is not a block cipher because the data is a single block, rather than several. This does not change the fact that it does indeed work in a block cipher manner.

-
 If you consider it a block-cipher, then it's clearly a broken block-cipher. – CodesInChaos Sep 4 '12 at 16:37 It's also common to assume that the block size is an integral number of bits, which isn't the case for RSA. – CodesInChaos Sep 4 '12 at 16:42