# What type of cipher is RSA?

Is RSA a stream cipher or a block cipher?

-

## 4 Answers

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 the acronym/initialism of three cryptographers Ron Rivest, Adi Shamir, and Len Adleman who founded a security company of the same name.

This is important because "RSA" can refer to a wide range of cryptographic products and patents:

• RSA public-key cryptography: An asymmetric algorithm published in 1977 that uses the difficulty of factoring large integers into primes to protect sharing of secrets over a public network.
• RC4 stream cipher: A symmetric cipher that converts a short shared secret into a pseudorandom number generator (keystream) to encrypt data. Invented as a RSA trade-secret in 1987 and leaked in 1994.
• RC2, RC5 and RC6 block ciphers: Block ciphers encrypt a single small block according to the shared secret - the core design trick being on how the shared secret is securely propagated across blocks. Some of these ciphers were trade-secrets, some were published openly (when obliged to).
• RSA SecuriID One-Time-Passwords: A hardware or software pseudorandom password number generator derived off a shared 128-bit secret known by both the server and the client. Like most RSA products, this one-time-password algorithm is a trade-secret - but a reversed engineered one.
-

According to wikipedia definitions, both stream and block ciphers require symmetric keys. RSA has an asymmetric key so it's not one of these.

If you drop the symmetric key requirement (I don't see why that's relevant anyway for the term "block" versus "stream") then it would be a block cipher.

-

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