Block Cipher and Stream Cipher are the methods used for converting the plain text into cipher text directly and belong to the family of symmetric key ciphers.
The major difference between a block cipher and a stream cipher is that the block cipher encrypts and decrypts a block of the text at a time. On the other hand, stream cipher encrypts and decrypts the text by taking the one byte of the text at a time.
Content: Block Cipher Vs Stream Cipher
|Basis for comparison||Block cipher||Stream cipher|
|Basic ||Converts the plain text by taking its block at a time.||Converts the text by taking one byte of the plain text at a time.|
|Complexity||Simple design||Complex comparatively|
|No of bits used||64 Bits or more||8 Bits|
|Confusion and Diffusion||Uses both confusion and diffusion||Relies on confusion only|
|Algorithm modes used||ECB (Electronic Code Book)|
CBC (Cipher Block Chaining)
|CFB (Cipher Feedback)
OFB (Output Feedback)
|Reversibility||Reversing encrypted text is hard.||It uses XOR for the encryption which can be easily reversed to the plain text.|
|Implementation||Feistel Cipher||Vernam Cipher|
Definition of Block Cipher
Block Cipher takes a message and break it into a fixed size of blocks and converts one block of the message at an instant. For example, we have a message in plain text “STREET_BY_STREET” required to be encrypted. Using bock cipher, “STREET” must be encrypted at first, followed by “_BY_” and finally at last “STREET”.
In actual practice, communication takes place only in bits. Therefore, STREET actually means the binary equivalent of ASCII character of STREET. Subsequently, any algorithm encrypts these; the resultant bits are transformed back into their ASCII equivalent.
An evident problem regarding the usage of Block ciphers is repeating text, for which the same cipher is generated. Hence, it would give a hint to the cryptanalyst which makes it is easier to figure out the recurring strings of plain text. As a result, it can reveal the whole message.
To overcome from this problem the chaining mode is used. In this technique, the preceding block of cipher text is mixed with the current block, so as to the cipher text vague, this avoids the recurring patterns of blocks with the same content.
Definition of Stream Cipher
Stream Cipher typically encrypts one byte of the message at that moment instead of using blocks. Let’s take an example, suppose the original message (plain text) is “blue sky” in ASCII (i.e. text format). When you convert these ASCII into equivalent binary values, it will give the output in 0’s and 1’s form. Let it be translated in 010111001.
For encryption and decryption, a pseudorandom bit generator is used in which a key and plain text are loaded. A pseudorandom bit generator creates a stream of 8-bit numbers that are seemingly random known as keystream. Let the input key is 100101011. Now the key and plaintext are XORed.
The XOR logic is simple to understand. XOR produces an output of 1 when one input is 0, and the other is 1. The output is 0 if either both the inputs are 0 or both the inputs are 1.
- Confusion is a method which guarantees that a cipher text gives no clue about the original plain text.
- Diffusion is a strategy used to enhance the redundancy of the plain text by spreading it across rows and columns.
Key Differences Between Block Cipher and Stream Cipher
- Block cipher technique involves encryption of one block of text at a time, i.e. singly. Similarly, decrypt the text by taking one block after another. In contrast, Stream cipher technique involves encryption and decryption of one byte of the text at a time.
- Block cipher uses both confusion and diffusion while stream cipher relies only on confusion.
- The usual size of the block could be 64 or 128 bits in the Block cipher. As against, 1 byte (8 bits) at a time is converted in the stream cipher.
- Block cipher uses ECB (Electronic Code Book) and CBC (Cipher Block Chaining) algorithm modes. On the contrary, Stream cipher uses CFB (Cipher Feedback) and OFB (Output Feedback) algorithm modes.
- Stream cipher uses XOR function for converting the plain text into cipher text, that is the reason why it is easy to reverse the XORed bits. Whereas Block cipher does not use XOR for doing so.
- Block cipher uses the same key to encrypt each block while stream cipher uses a different key for each byte.
Block Cipher and Stream Cipher differ in the way in which plain text is encrypted and decrypted. The idea behind block cipher is to divide the plain text into blocks further encrypt those blocks. While stream cipher converts plain text bit by bit similar to stream.