 a stream cipher is a symmetric key cipher where plaintext digits are combined with a pseudorandom cipher digit stream (keystream). in a stream cipher each plaintext digit is encrypted one at a time with the corresponding digit of the keystream, to give a digit of the ciphertext stream. an alternative name is a state cipher, as the encryption of each digit is dependent on the current state. in practice, a digit is typically a bit and the combining operation an exclusive-or (xor). the pseudorandom keystream is typically generated serially from a random seed value using digital shift registers. the seed value serves as the cryptographic key for decrypting the ciphertext stream. stream ciphers represent a different approach to symmetric encryption from block ciphers. block ciphers operate on large blocks of digits with a fixed, unvarying transformation. this distinction is not always clear-cut: in some modes of operation, a block cipher primitive is used in such a way that it acts effectively as a stream cipher. stream ciphers typically execute at a higher speed than block ciphers and have lower hardware complexity. however, stream ciphers can be susceptible to serious security problems if used incorrectly (see stream cipher attacks); in particular, the same starting state (seed) must never be used twice. ==loose inspiration from the one-time pad== stream ciphers can be viewed as approximating the action of a proven unbreakable cipher, the one-time pad (otp), sometimes known as the vernam cipher. a one-time pad uses a keystream of completely random digits. the keystream is combined with the plaintext digits one at a time to form the ciphertext. this system was proved to be secure by claude e. shannon in 1949. however, the keystream must be generated completely at random with at least the same length as the plaintext and cannot be used more than once. this makes the system very cumbersome to implement in practice, and as a result the one-time pad has not been widely used, except for the most critical applications. a stream cipher makes use of a much smaller and more convenient key such as 128 bits. based on this key, it generates a pseudorandom keystream which can be combined with the plaintext digits in a similar fashion to the one-time pad. however, this comes at a cost. the keystream is now pseudorandom and so is not truly random. the proof of security associated with the one-time pad no longer holds. it is quite possible for a stream cipher to be completely unsecure. ==types of stream ciphers== a stream cipher generates successive elements of the keystream based on an internal state. this state is updated in essentiall
Cryptographic_primitives Stream_ciphers