- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Difference between Block Cipher and Stream Cipher
Both Block cipher and Stream cipher belong to the family of symmetric key ciphers which are the basically encryption methods primarily used for converting the plaintext into ciphertext directly.
Go through this article to find out more about the features of block ciphers and stream ciphers and how they are different from each other.
What is Block Cipher?
A block cipher is a symmetric cryptographic technique that uses a shared, secret key to encrypt a fixed-size data block. During encryption, plaintext is used, and ciphertext is the resultant encrypted text. The plaintext and ciphertext are both encrypted using the same key.
A block cipher processes the data blocks of fixed size. Usually, the size of a message is larger than the block size. Hence, the long message is divided into a series of sequential message blocks, and the cipher operates on these blocks one at a time.
Using a shared, secret key, a block cipher encrypts and decrypts its input one block rather than one bit at a time. Padding is not required because the block is fixed in size. This is a symmetric algorithm. It transforms textual input into cyphertext using the shared key during encryption (encrypted text). It employs the same key to convert the cyphertext back to the original plaintext during decryption. The length of the output is the same as the length of the input.
The Data Encryption Standard (DES), TripleDES, and the Advanced Encryption standard are well-known versions of the block cipher algorithm (AES).
The stream cipher, which uses a shared key and operates on its input one bit at a time, is the block cipher's counterpart.
Public-key cryptography or asymmetric cryptography are alternatives to the block cipher algorithm. This algorithm encrypts plaintext with a public key and decrypts the ciphertext with a private key.
There are different modes of operation of a block cipher −
Electronic Code Book (ECB) Mode
Cipher Block Chaining (CBC) Mode
Cipher Feedback (CFB) Mode
Output Feedback (OFB) Mode
Counter (CTR) Mode
These modes are procedural rules for a generic block cipher. Interestingly, the different modes result in different properties being achieved which add to the security of the underlying block cipher.
What is Stream Cipher?
A stream cipher is an encryption method that combines a pseudorandom cipher digit stream with plain text digits. This pseudorandom encryption digit stream is applied one bit at a time to each binary digit. This encryption method employs an endless amount of pseudorandom cipher digits for each key.
A stream cipher employs a key-based algorithm to encrypt an arbitrary amount of plain text one bit at a time.
The pseudorandom cipher numbers should be unpredictable, and the key should never be used more than once for this type of encryption to be secure.
The pseudorandom cipher digits are created using digital shift registers and several random seed values.
Stream cipher is also known as State cipher. The name "state cipher" comes from the fact that each number's encryption depends on the current state of the cipher.
The RC4 stream cipher is widely used in the software.
With a properly designed pseudorandom number generator, a stream cipher can be as safe as a block cipher of equal key length. The main advantage of a stream cipher is that it uses far less code and it is faster than block ciphers.
Difference between Block Cipher and Stream Cipher
The following table highlights the major differences between a block cipher and a stream cipher −
|Key||Block Cipher||Stream Cipher|
|Definition||Block Cipher is the type of encryption where the conversion of plaintext is performed by taking its block at a time.||Stream Cipher is the type of encryption where the conversion of plaintext is performed by taking one byte of the plaintext at a time.|
|Conversion of Bits||Since Block Cipher converts blocks at a time, it converts a more significant number of bits than Stream Cipher, which can convert 64 bits or more.||In the case of Stream Cipher, however, only 8 bits can be transformed at a time.|
|Principle||Block Cipher uses both "confusion" and "diffusion" principle for the conversion required for encryption.||Stream Cipher uses only confusion principle for the conversion.|
|Algorithm||For encryption of plain text Block Cipher uses Electronic Code Book (ECB) and Cipher Block Chaining (CBC) algorithm.||Stream Cipher uses CFB (Cipher Feedback) and OFB (Output Feedback) algorithm.|
|Decryption||As a combination of more bits get encrypted in case of Block Cipher, so the reverse encryption or decryption is comparatively complex as compared to that of Stream Cipher.||Stream Cipher uses XOR for the encryption which can be easily reversed to the plain text.|
|Implementation||Feistel Cipher is the most common Block Cipher implementation.||The main implementation of Stream Cipher is Vernam Cipher.|
Block ciphers are suitable for applications that manage blocks of data including file transfer, e-mail, and database. Stream ciphers, on the other hand, are more useful for applications that need to encrypt/decrypt a stream of data, including over a data communications channel or a browser/Web link.
- What is the comparison between Stream Cipher and Block Cipher in information security?
- Difference between Monoalphabetic Cipher and Polyalphabetic Cipher
- Difference between Substitution Cipher Technique and Transposition Cipher Technique
- What is Stream Cipher in Information Security?
- What is Block Cipher in information security?
- What are the popular examples of Block Cipher?
- What are the components of Modern Block Cipher in Information Security?
- XOR Cipher in C++
- Atbash cipher in Python
- Caesar Cipher in Python
- Polybius Square Cipher in C++
- What are the different modes of operation in Block Cipher in information security?
- C++ Program to Implement Affine Cipher
- What is Monoalphabetic Cipher in Information Security?
- What are the techniques of Monoalphabetic Cipher?