2 Symmetric key cryptography
2.2 Stream cipher algorithms

A stream cipher is a symmetric cipher which operates with a time-varying transformation on individual digits of the plaintext. This is achieved by adding a digit from a keystream to a plaintext digit. The keystream, also called the running-key, is a pseudo-random sequence (a sequence that appear like a random sequence to an attacker) produced by a finite state automaton whose initial state is determined by a secret key and a public parameter.

The security of a stream cipher completely depends on the keystream. The keystream must be unpredictable to prevent a successful attack.

Fig 2.8 Example of a stream cipher: the Trivium

Stream ciphers sometimes require fewer resources, e.g., code size or chip area, for implementation than block ciphers, and they are attractive for use in constrained environments such as cell phones.

Stream ciphers are less popular than block ciphers in most domains such as Internet security. There are exceptions, for instance, the popular stream cipher RC4.

## Types of stream ciphers

A stream cipher generates successive elements of the keystream based on an internal state. In a synchronous stream cipher, the state update mechanism is updated independently of the plaintext and the ciphertext. By contrast, self-synchronising stream ciphers update their state based on previous ciphertext digits.

Synchronous stream ciphers

A synchronous stream cipher is a stream cipher, in which the keystream is generated independently of the plaintext and of the ciphertext. The keystream is usually produced by a pseudorandom generator, parameterized by a key, which is the secret key of the whole scheme.

Fig 2.9 Synchronous stream cipher

Some important properties of synchronous stream ciphers include the following:

- No error propagation: a single bit error on cj only affects the corresponding bit of pj. The transmission error will not affect the decryption of other digits
- In order to get a proper decryption, sender and receiver need to be synchronized. If a digit is inserted or deleted during transmission, sender and receiver need to be resynchronized

Self-Synchronizing Stream Cipher

In a self-synchronizing, or asynchronous, stream cipher, the keystream depends on the secret key of the scheme, but also of a fixed number, say t, of ciphertext digits (that have already been produced, or read; this distinguishes it from a synchronous stream cipher).

Fig 2.9 Self-synchronizing stream cipher

Self-synchronizing The main properties of this scheme are the following:

- Self-synchronization: if some digits of the ciphertext are deleted, inserted or flipped, the cipher is able to automatically resume proper decryption after some digits.
- Limited error propagation: the effect of single digit errors is limited, only some ciphertext digits will be wrongly decrypted.