Understanding stream ciphers in cryptography
Stream ciphers fall under the symmetric encryption category. Thus, using stream ciphers the sender and the recipient of the data use the same key to encrypt and decrypt the data.
A stream cipher is different from a block cipher. In a stream cipher one byte (8 bit) of data is encrypted at a time while in block cipher, a block of data is encrypted at a time (usually 128 bits).
Learn Applied Cryptography
What is a keystream?
Stream ciphers make use of something called keystream. A keystream is a random 8-bit output that is generated by supplying a key to a pseudorandom bit generator. The 8-bit output generated is called keystream and is used in the encryption and decryption of data in a given stream cipher algorithm.
Encryption
Steps
- For encryption, plain text and keystream are required.
- The plain text and keystream produce ciphertext using XOR Operation.
- Plain text is XOR’ed with keystream bit by bit to produce CipherText.
Example
Plain Text: 10011001
Keystream: 11000011
---------------------
Ciphertext: 01011010
Decryption
Steps
- For decryption, ciphertext and the same keystream are required which was used for encryption.
- The ciphertext and the keystream produce plain text using XOR Operation.
- The ciphertext is XOR’ed with keystream bit by bit to produce PlainText.
Example
Ciphertext: 01011010
Keystream: 11000011
----------------------
Plain Text: 10011001
Popular stream ciphers
Following are the popular stream ciphers used for encrypting the data.
- RC4
- SALSA
- SOSEMANUK
- PANAMA
Block cipher and stream cipher differences
Following are the differences between block cipher and stream cipher in tabulated form.
Learn Applied Cryptography