Stream Ciphers Vs Block Ciphers
A stream cipher is one that encrypts a digital data stream one bit or one byte at a time. Examples of classical stream ciphers are the autokeyed Vigenère cipher and the Vernam cipher. In the ideal case, a one-time pad version of the Vernam cipher would be used, in which the keystream ($k_i)$ is as long as the plaintext bit stream ($p_i)$. If the cryptographic keystream is random, then this cipher is unbreakable by any means other than acquiring the keystream. However, the keystream must be provided to both users in advance via some independent and secure channel. This introduces insurmountable logistical problems if the intended data traffic is very large.
Accordingly, for practical reasons, the bit-stream generator must be implemented as an algorithmic procedure, so that the cryptographic bit stream can be produced by both users. In this approach (Figure 4.1a), the bit-stream generator is a key-controlled algorithm and must produce a bit stream that is cryptographically strong. That is, it must be computationally impractical to predict future portions of the bit stream based on previous portions of the bit stream. The two users need only share the generating key, and each can produce the keystream.
A block cipher is one in which a block of plaintext is treated as a whole and used to produce a ciphertext block of equal length. Typically, a block size of 64 or 128 bits is used. As with a stream cipher, the two users share a symmetric encryption key (Figure 4.1b). Using some of the modes of operation , a block cipher can be used to achieve the same effect as a stream cipher.
Far more effort has gone into analyzing block ciphers. In general, they seem applicable to a broader range of applications than stream ciphers. The vast majority of network-based symmetric cryptographic applications make use of block ciphers.
Stream Cipher vs Block Cipher
1. Basic Definition:
- Stream Cipher: A stream cipher encrypts data one bit or one byte at a time, in a continuous stream. Think of it like encrypting a flowing river of data.
- Block Cipher: A block cipher encrypts data in fixed-size chunks, called blocks, usually of 64 or 128 bits. It's like encrypting one piece of a puzzle at a time.
2. Mode of Operation:
- Stream Cipher: It processes the plaintext continuously, which is why it's very fast and suitable for scenarios where data comes in a steady flow (e.g., network traffic or streaming).
- Block Cipher: The data is divided into blocks of fixed size, and each block is encrypted individually. If the data is smaller than the block size, padding may be added.
3. Key Usage:
- Stream Cipher: Uses a keystream generated from the encryption key. The plaintext is XORed with this keystream to produce ciphertext. The keystream is often generated using pseudo-random number generators (PRNGs).
- Block Cipher: A single key is used to encrypt an entire block of data. Each block is processed separately, and multiple modes of operation (like ECB, CBC, etc.) dictate how subsequent blocks are influenced by previous ones.
4. Speed:
- Stream Cipher: Generally faster than block ciphers because it encrypts data bit-by-bit or byte-by-byte without needing to wait for a full block.
- Block Cipher: Can be slower, especially with larger block sizes, because the entire block needs to be processed before moving on to the next.
5. Security Considerations:
- Stream Cipher: Since stream ciphers are sensitive to key reuse, using the same key and initialization vector (IV) more than once can compromise security. Keystream needs to be unique for each session.
- Block Cipher: Reusing keys isn’t as critical a concern if used in secure modes of operation like CBC or GCM. However, it’s still important to avoid repeating initialization vectors in some modes.
6. Example Algorithms:
- Stream Cipher: RC4 (though not recommended anymore due to vulnerabilities), Salsa20, ChaCha20.
- Block Cipher: AES (Advanced Encryption Standard), DES (Data Encryption Standard), Blowfish.
7. Use Cases:
- Stream Cipher: Ideal for situations where data arrives in an unpredictable stream, such as in real-time communications (voice calls, video streams).
- Block Cipher: Suitable for encrypting large files, database encryption, or situations where data is stored and can be processed in chunks.
Comments
Post a Comment