page_title: Stream cipher
section_title: Usage
hierarchical_section_title: Stream cipher / Usage
context_page_description: In cryptography, a stream cipher is a symmetric key cipher where plaintext bits are combined with a pseudorandom cipher bit stream using an exclusive-or operation. In a stream cipher the Plaintext digits are encrypted one at a time, and the transformation of successive digits varies during the encryption state. An alternative name is a state cipher, as the encryption of each digit is dependent on the current state. In practice, the digits are typically single bits or bytes.
  Stream ciphers represent a different approach to symmetric encryption from block ciphers. Block ciphers operate on large blocks of fixed length. Stream ciphers typically execute at a higher speed than block ciphers and have lower hardware requirements. However, stream ciphers can be susceptible to serious security problems if used incorrectly; for example, in particular, the same starting state must never be used twice.
  A stream cipher makes use of a much smaller and more convenient cryptographic key, for example 128 bits keys. Based on this key, it generates a pseudorandom keystream which can be combined with the plaintext digits in a similar way to the one-time pad encryption algorithm.
context_section_description: Stream ciphers are often used in applications where plaintext comes in quantities of unknowable length as in secure wireless connections. If a block cipher were to be used in this type of application, the designer would need to choose either transmission efficiency or implementation complexity, since block ciphers cannot directly work on blocks shorter than their block size. For example, if a 128-bit block cipher received separate 32-bit bursts of plaintext, three quarters of the transmitted data need padding. Block ciphers must be used in ciphertext stealing or residual block termination mode to avoid padding, while stream ciphers eliminate this issue by operating on the smallest transmitted unit (usually bytes).
  Another advantage of stream ciphers in military cryptography is that the cipher stream can be generated by an encryption device that is subject to strict security measures then fed to other devices, e.g. a radio set, which will perform the xor operation as part of their function.  The other device can be designed for used in less securely environments.
  RC4 is the most widely used stream cipher in software; others include: 
  A5/1,
  A5/2,
  Chameleon, 
  FISH, 
  Helix,
  ISAAC, 
  MUGI,
  Panama,
  Phelix, 
  Pike,
  SEAL, 
  SOBER,
  SOBER-128 and
  WAKE.
caption: RC4 is one of the most widely used stream cipher designs.