Saltar al contenido

# Difference between block cipher and Stream cipher

Block Cipher and Stream Cipher are the methods used to directly convert plain text to ciphertext and belong to the family of symmetric key ciphers.

The main difference between a block code and a flow code that the block code encrypts and decrypts one block of text at a time. On the other hand, the stream cipher encrypts and decrypts the text by taking one byte of the text at a time.

### Comparative graph

Basis for comparison Block cipher Stream cipher
Basic Convert plaintext by taking its block at a time. Convert text by taking one byte of plain text at a time.
complexity Simple design Complex relatively
Number of bits used 64 bits or more 8 bit
Confusion and Diffusion Use both confusion and spread It is based only on confusion
Algorithm modes used ECB (Electronic Code Book) CBC (Cipher Block Chaining) CFB (Cipher Feedback) OFB (Exit Feedback)
reversibility The reversal of encrypted text is difficult. Use XOR for encryption which can be easily reversed in plain text.
Implementation Feistel Cipher Vernam Cipher

### Definition of Block Cipher

Block Cipher takes a message and breaks it into a fixed block size and converts a block of the message in an instant. For example, we have a plain text message "STREET_BY_STREET" required to be encrypted. Using the bock code, "STREET" must first be encrypted, followed by "_BY_" and finally "STREET". In practice, communication takes place only in bits. Therefore, STREET actually indicates the binary equivalent of the ASCII character of STREET. Subsequently, any algorithm encrypts them; the resulting bits are transformed into their ASCII equivalent.

An obvious problem concerning the use of block ciphers la repetition of the text, for which the same code is generated. So, it would give the cryptanalyst a hint that makes it easier to understand recurring simple text strings. As a result, it can reveal the whole message.

To overcome this problem the chaining mode . In this technique, the previous block of ciphertext mixed with the current block, so that the ciphertext vague, this avoids the recurring patterns of blocks with the same content.

### Definition of Stream Cipher

Stream Cipher typically encrypts a byte of the message at that time instead of using locks. We do a example, suppose that the original message (plain text) is "blue sky" in ASCII (ie in text format). When converting these ASCII to equivalent binary values, give the output in the form 0 and 1. Let it be translated into 010111001.

For encryption and decryption, a pseudorandom bit generator in which a key and plain text are loaded. A pseudorandom bit generator creates a stream of seemingly random 8-bit numbers known as keystream . Let the input key be 100101011. Now the key and plaintext are XORed. The XOR logic simple to understand. XOR produces an output of 1 when one input 0 and the other 1. Output 0 if both inputs are 0 or both inputs are 1.

The confusion a method which ensures that ciphertext does not give any clue about the original plaintext. The diffusion a strategy used to improve the redundancy of plain text by spreading it over rows and columns.

## Key differences between the block cipher and the flow cipher

1. The block cipher technique involves encrypting one block of text at a time, for example individually. Similarly, decipher the text by taking one block after another. On the contrary, the Stream cipher technique provides for the encryption and decryption of one byte of the text at a time.
2. The block cipher uses both confusion and dissemination while the flow code is based only on confusion.
3. The normal block size could be 64 or 128 bits in the block code. Conversely, 1 byte (8 bits) at a time is converted into the stream code.
4. Block cipher uses algorithm modes ECB (Electronic Code Book) is CBC (Cipher Block Chaining) . In contrast, Stream cipher uses the algorithm modes CFB (Cipher Feedback) is OFB (Output Feedback) .
5. The Stream cipher uses the XOR function to convert plain text to ciphertext, which is why it's easy to reverse the XORed bits. Whereas Block Cipher doesn't use XOR to do it.
6. Block cipher uses the same key to encrypt each block while stream code uses a different key for each byte.

### Conclusion:

Block Cipher and Stream Cipher differ in the way plain text is encrypted and decrypted. The idea behind block cipher is to divide plain text into blocks and then further encrypt them. While the stream cipher converts plain text bit by bit in a similar way to the stream.