Foundations of Blockchain
上QQ阅读APP看书,第一时间看更新

Stream cipher

The stream cipher uses symmetric key cryptography. Each plaintext character is encrypted one at a time, like a stream, to create the ciphertext. A keystream, or stream of characters, is used to encrypt the plaintext characters. A pseudorandom string is used, which acts as a keystream. This pseudorandom string is generated from a random seed value using digital shift registers (generator) as shown in Figure 2.3. The seed used is the secret key, which is also used to decrypt the created ciphertext.

For a stream cipher to be secure, its pseudorandom generator should be unpredictable, and its seed value used to generate the keystream should never be reused to reduce the possible attacks. Stream ciphers are generally faster than block ciphers and have low hardware requirements, as demonstrated in the following diagram:

Figure 2.3: Flow diagram of the stream cipher