Block Cipher Vs Stream Cipher – the Difference Explained

1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 4.50 out of 5)
Loading...
block cipher vs stream cipher

Get An Overview and Head-to-Head Comparison of Block Cipher Vs Stream Cipher!

No matter if you’re using the internet for banking or for sending a message on WhatsApp, encryption has a role to play everywhere. For example, whenever you enter your credentials on the web, they are shared across the internet in an encrypted form. It ensures security. Ciphers responsible for keeping your data safe are of two types, namely Block Cipher and Stream Cipher. Now, what are they, and how are they different? Let’s read ahead and compare Block Cipher vs Stream Cipher.

Both of these Ciphers are a part of symmetric encryption. Symmetric encryption is a process where the same key is used to encrypt and decrypt the data. Some of the best examples of symmetric encryption are Blowfish, AES, DES, RC6, etc.

Here is how stream ciphers and block ciphers are used in symmetric encryption!

Difference Between Block Cipher and Stream Cipher Explained

Before we jump into the comparison of block vs stream cipher, let’s analyze them individually!

What is Block Ciphers?

As the name suggests, the block ciphers are used to encrypt the data and return an output of a fixed block size. It means that no matter what is the size of the input, the resultant ciphertext will be of fixed block size. The size of the ciphertext is usually in octaves (the multiples of 8). However, it also depends on the encryption scheme used in the ciphering method.

Here is Examples of Block Cipher

If you have a plain text of 148 bits, but the encryption scheme used is 128-bit encryption, the remaining 20 bits will be adjusted in the second block. As there will be space for 108 more bits, the encryption scheme will add padding of 0s or 1s or both to complete the ciphertext block.

Now, as we know that ciphertexts are of fixed blocks, and they are encrypted. But how?

Block ciphers use symmetric keys and algorithms to encrypt sensitive data. As they can be used for various modes, the complexity of encryption can vary. For example, the blocks are chained together in some modes.

Here is the process of how chained block ciphers work!

In this process, a pseudorandom sequence of characters is used to encrypt the first block of characters. This random sequence of characters is termed as Initialization Vector (IV). After obtaining the first block cipher, it is used as an IV for the next block. This process is followed for each block, and it thus produces a unique ciphertext each time.

The core benefit of a block cipher is that it is tamper-proof, which means that no one can crack it. As the IV used for each iteration is different and dependent on the previous block, the cipher has high diffusion.

Though it is highly unlikely, a change of one character can lead to a massive change in the cipher. Hence, the block cipher also has a higher error propagation rate.

What are the different techniques of block ciphers cryptography

Some of the best examples of block ciphers are:

  • DES (Data Encryption Standard)
  • AES (Advanced Encryption Standard)
  • Twofish
  • Blowfish
  • RC5
  • Triple-DES

Modes of Operation for Block Ciphers

As we have teased the modes of block ciphers above, let’s explore them properly here! The modes of block ciphers are divided into two major categories, namely.

Confidentiality-only modes

There are three types under this!

1. Electronic Codebook: The ECB method splits the plaintext into various blocks. Each block is applied with encryption separately. As the pattern is not hidden in this case, it cannot be used in security frameworks.

2. Cipher block chaining mode (CBC: As explained above, the output ciphertext of one block is used as an initialization vector for the following block with plaintext input using the XOR function.

3. Propagating cipher block chaining (PCBC): This method involves XOR of current plaintext, previous plaintext, and previous ciphertext.

Authenticated encryption with additional data operation modes

There are two categories under this!

1. Galois Counter mode: In this mode, an incremental counter is used to generate a universal hash that generates message authentication codes before encryption and decryption.

2. Synthetic initialization vector (SIV): The SIV block cipher uses a plaintext input, an encryption key, and a header to achieve authenticated encryption. The header used is an authenticated variable-length octet string. SIV keeps the plaintext private while keeping the authenticity of the header and encryption key intact.

What is Stream Ciphers?

Just like its name, the stream cipher encrypts the data in a continuous stream. Unlike block ciphers, bit-by-bit encryption happens in Stream ciphers. How?

Here is the Stream Cipher uses and process!

The input plaintext is not arranged in blocks before encryption, but it is directly encrypted bit by bit. The encryption process uses keystreams that are generated by combining an encryption key and a seed, called the nonce. The combination of the two produces a pseudorandom number, a keystream that is XORed (exclusive disjunction) with the plaintext to make the ciphertext.

Now, the encryption key used here can be 128 or 256 bits, and nonce can be 64 or 128 bits. The keystream used to produce ciphertext has to be unique, but the encryption key and nonce can be reused. As it may seem tough, the process uses feedback shift registers that generate a unique seed or nonce every time. This nonce is only used one time to create the keystream.

Now, the major benefit of stream ciphers is that they are less likely to experience system-wide propagation errors. How? As each bit is encrypted individually, it will not affect the ciphertext of the entire string, hence, fewer chances of errors. Moreover, as stream ciphers happen in a continuous stream, they are faster and easy to implement.

As each bit is converted to ciphertext, stream ciphers do not have diffusion. Hence, hackers can easily break them. They can easily add or manipulate a message without being noticed.

Stream ciphers are ideal for scenarios where the amount of plain text is more and cannot be determined.

Some of the best examples of Stream Ciphers are

  • A5
  • ChaCha40
  • Salsa20
  • RC4

Stream Ciphers Examples

The stream ciphers are primarily of two types!

1. Synchronous Stream Ciphers: These types of ciphertexts are generated without the use of keystreams that are not generated using previous ciphertexts or plaintexts. For each ciphertext, a unique pseudorandom number is used to make the keystream. This keystream is further XORed with the plaintext to generate the ciphertext.

2. Asynchronous Stream Ciphers: In this cipher, the keystream is generated using the synchronous key and fixed size of the previous ciphertext. As the contents of the ciphertext are affected, the respective keystream is also affected. This cipher can be used to detect active attacks and further limit error propagation.

Differentiate Stream Cipher and Block Cipher using a suitable example. – How Do They Vary?

The block cipher vs stream cipher comparison is easy to make as we know what they are! So, let’s get started! Here is a quick tabular comparison of both the ciphers!

Block CipherStream Cipher
It requires a block of data at a time for ciphering.The stream cipher converts 1 byte of data at a time into ciphers.
Block cipher is less complex.The complexity of stream cipher is more.
Block cipher offers better data securityStream cipher is limited to maintaining confidentiality, not authentication.
Reversibility is slowReversibility is faster
The need for resources is highResources required by stream cipher are less

Conversion

One of the prime and visible differences between block vs stream cipher is bit conversion. How? Well, the block conversion method requires the block of plaintext that needs to be accumulated first and then converted to ciphertext. On the other hand, the stream cipher converts quickly as plaintext is encrypted one bit at a time. Thus, making it continuous and fast.

As the devices today are fast, the time difference may not be that significant.

Security

If we compare the ciphers based on security, the strength of the key determines the power of a cipher. However, out of both of these ciphers, block ciphers can be used to provide authenticated encryption, not stream cipher. So, a block cipher is better. Stream cipher only uses the confusion principle to encrypt data, so it is better only in terms of maintaining confidentiality.

Reversibility

It is obvious that if the ciphering takes more time to encrypt, the decryption time will also be more. Stream-based encryption can be easily reversed by XORing their outputs. But, in the case of block cipher, the bits encrypted are more. Hence, the reversibility, in this case, is slow.

Resources

This is where the stream ciphers outshine from block ciphers. As block ciphers require complex calculations as compared to stream ciphers, they require relatively more resources.

Redundancy

Redundancy is one of the critical factors. If the block cipher does not find exact octaves in the input plaintext, it adds padding bits to complete the block. Though it is necessary to produce the ciphertext, it also increases the redundancy of plain text.

However, stream ciphers do not have any redundancies as it encrypts bit by bit.

Application area

As block cipher provides authenticated encryption, it is best for almost any type of application where encryption is necessary. In contrast, the stream cipher is used only for certain applications like data-in-transit encryption.

So, that’s all about Block Cipher Vs Stream Cipher.

Wrapping Up!

So, we know that encryption is the wall that stands between your sensitive data and the hackers. And the warriors that take care of this wall are the block and stream ciphers. Block ciphers are powerful in terms of security but slow. On the other hand, the stream ciphers have a limited scope of application but are faster than block ciphers.

We hope this article was fruitful and you enjoyed reading it!

Janki Mehta

Janki Mehta

Janki Mehta is a Cyber-Security Enthusiast who constantly updates herself with new advancements in the Web/Cyber Security niche. Along with theoretical knowledge, she also implements her practical expertise in day-to-day tasks and helps others to protect themselves from threats.

Cheap Wildcard SSL