Stream Ciphers
A symmetric encryption method that encrypts data one bit at a time.
The stream cipher is based on the one-time pad (OTP) concept that was popular back in WWII days.
OTP Characteristics
The OTP is a symmetric cipher that uses a secret key to encrypt and decrypt data. The secret key is the same length as the data being encrypted. Each byte of the secret key is XORed with the corresponding byte of the plaintext, generating the ciphertext. The OTP demonstrates perfect secrecy, that is its just as hard to brute-force the secret key than it is to brute-force the data itself. However, perfect secrecy is only maintained as long as the secret key is used once.
OTP only works well with small messages, since the secret key is the same length as the data itself. However, this can be resolved by generating seed keys instead of normal OTP keys. Seed keys are usually fixed in length, often 2048 bits long. Seed keys are generated by:
- Passing the fixed-length key through a pseudorandom number generator (pRNG), which outputs a new and unique encryption key the same size as the data being encrypted. This is called the keystream.
- The keystream is XORed with the data to create the ciphertext.
- The seed key is now usable multiple times throughout the encryption process.
One of the more popular stream ciphers that used this method was Rivest's Cipher 4 (RC4). However, with time, vulnerabilities were discovered and RC4 is no longer in popular use.