A stream cipher is a cipher in which the input data is encrypted one bit (sometimes one byte) at a time. They are sometimes called state ciphers since the encryption of a bit is dependent on the current state. Stream ciphers represent a line of cipher development which is different from block ciphers although there are simple mathematical transformations that convert stream ciphers to block ciphers and vice versa. They are generally faster to execute in hardware than block ciphers.

Most stream ciphers consist of a pseudorandom number generator(PRNG) and an XOR gate. The PRNG is initialized with a key, and outputs a sequence of bits known as a keystream. Encryption consists of XORing the plaintext bits with the corresponding bits of the keystream; decryption consists of XORing the ciphertext bits with the corresponding keystream bits. This means that a single bit of ciphertext error results in a single bit of plaintext error; this property is useful when the transmission error rate is high. However, a stream cipher is susceptible to bit-fiddling attacks - dropping a bit will result in complete garbage. Some ciphers, called self-synchronizing stream ciphers, use several previous ciphertext bits to compute the keystream (as opposed to synchronous stream ciphers, in which the keystream is generated independently of the plaintext and the ciphertext). A single-bit error then turns into a long burst of garbage, but the cipher will recover from a lost bit after the erroneous bit falls off the shift register.

Keystream generators are often constructed using linear feedback shift registers.

Probably the best known stream cipher is RC4; others include SEAL, Wake, FISH, Pike, A5/1, A5/2, Enigma, Panama, ISAAC, Chameleon, SOBER and HELIX.