4 Stream ciphers
This chapter covers
- What makes a symmetric encryption ideal
- Understanding the exclusive-or operation and its importance for cryptography
- Achieving unbreakable encryption with a one-time pad
- How stream ciphers are related to one-time pads
- Implementing and exploiting linear feedback shift registers and RC4 stream ciphers
One of the core goals of cryptography is to provide confidentiality. Stream ciphers are algorithms that help achieve confidentiality by encrypting plaintext 1 bit or 1 byte at a time. They are used heavily in systems with limited computing power (e.g., embedded devices) or where performance requirements are high (for example, for real-time encryption of video calls). This chapter will explain what stream ciphers are, how they are generally used, and how attackers circumvent them.
4.1 Symmetric key encryption
Recall from chapter 1 that symmetric key encryption involves using the same key for both encryption and decryption operations, as shown again for reference in figure 4.1. As it happens, there is already a perfect unbreakable algorithm for achieving this. It just comes with some practical limitations that prevent it from becoming “one encryption algorithm to rule them all.” Understanding those limitations will also shed further light on the distinctions between cryptographic theory and implementation; but before we get to the limitations, let’s first discuss what it means for an encryption algorithm to be perfect.