** Stream Cipher vs Block Cipher | State Cipher vs Block Cipher
**

In cryptography, Stream ciphers and Block ciphers are two encryption/decryption algorithms that belong to the family of symmetric key ciphers. Typically a cipher takes a plain-text as input and produces a ciphertext as output. Block ciphers encrypts fixed-length block of bits using an unvarying transformation. Stream ciphers encrypt streams of bits with varying length and use varying transformation on each bit.

**What is a Stream Cipher?**

Stream ciphers belong to the family of symmetric key ciphers. Stream ciphers combine plain-text bits with a pseudorandom cipher bits stream with the use of XOR (exclusive-or) operation. Stream ciphers encrypt plain-text digits one at a time with varying transformations for successive digits. Because the encryption of each digit depends on the current state of the cipher engine, stream ciphers are also known as state ciphers. Typically, single bits/bites are used as single digits. To avoid security concerns, it should be made sure that the same starting state is not used more than once. Most widely used stream cipher is RC4.

**What is a Block Cipher?**

A block cipher is another symmetric key cipher. Block ciphers operate on blocks (groups of bits) with fixed-length. Block ciphers use a fixed (unvarying) transformation for all digits in the block. For example, when an x-bit block plain-text (along with a secret key) is provided as input to the block cipher engine, it produces the corresponding x-bit block of ciphertext. The actual transformation is dependent on the secret key. Similarly, the decryption algorithm recovers the original x-bit block of plaintext using the x-bit block of ciphertext and the above secret key as the input. In case the input message is too long compared to the size of the block, it will be broken down to blocks and these blocks will be (individually) encrypted using the same key. However, because the same key is used, each repeated sequence in the plain-text becomes the same repeated sequence in the cipher-text, and this could cause security concerns. Popular block ciphers are DES (Data Encryption Standard) and AES (Advanced Encryption Standard).

**What is the difference between a Stream Cipher and a Block Cipher?**

Although both stream ciphers and block ciphers belong to the family of symmetric encryption ciphers, there are some key differences. Block ciphers encrypt fixed length blocks of bits, while stream ciphers combine plain-text bits with a pseudorandom cipher bits stream using XOR operation. Even though block ciphers use the same transformation, stream ciphers use varying transformations based on the state of the engine. Stream ciphers usually execute faster than block ciphers. In terms of hardware complexity, stream ciphers are relatively less complex. Stream ciphers are the typical preference over block ciphers when the plain-text is available in varying quantities (for e.g. a secure wifi connection), because block ciphers cannot operate directly on blocks shorter than the block size. But sometimes, the difference between stream ciphers and block ciphers is not very clear. The reason is that, when using certain modes of operation, a block cipher can be used to act as a stream cipher by allowing it to encrypt the smallest unit of data available.

## Leave a Reply