Related Articles

Related Articles

Stream Ciphers
  • Last Updated : 16 Oct, 2020

In stream cipher, one byte is encrypted at a time while in block cipher ~128 bits are encrypted at a time.

Initially, a key(k) will be supplied as input to pseudorandom bit generator and then it produces a random 8-bit output which is treated as keystream.

The resulted keystream will be of size 1 byte, i.e., 8 bits.

  1. Stream Cipher follows the sequence of pseudorandom number stream.
  2. One of the benefits of following stream cipher is to make cryptanalysis more difficult, so the number of bits chosen in the Keystream must be long in order to make cryptanalysis more difficult.
  3. By making the key more longer it is also safe against brute force attacks.
  4. The longer the key the stronger security is achieved, preventing any attack.
  5. Keystream can be designed more efficiently by including more number of 1s and 0s, for making cryptanalysis more difficult.
  6. Considerable benefit of a stream cipher is, it requires few lines of code compared to block cipher.

Encryption :
For Encryption,

  • Plain Text and Keystream produces Cipher Text (Same keystream will be used for decryption.).
  • The Plaintext will undergo XOR operation with keystream bit-by-bit and produces the Cipher Text.

Example –

Plain Text : 10011001
Keystream  : 11000011
Cipher Text : 01011010

Decryption :
For Decryption,

  • Cipher Text and Keystream gives the original Plain Text (Same keystream will be used for encryption.).
  • The Ciphertext will undergo XOR operation with keystream bit-by-bit and produces the actual Plain Text.

Example –

Cipher Text : 01011010
Keystream   : 11000011
Plain Text  : 10011001

Decryption is just the reverse process of Encryption i.e. performing XOR with Cipher Text.

Diagram of Stream Cipher

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :