In cryptography, a keystream is a stream of random or pseudorandom characters that are combined with a plaintext message to produce an encrypted message (the ciphertext).

The "characters" in the keystream can be bits, bytes, numbers or actual characters like A-Z depending on the usage case.

Usually each character in the keystream is either added, subtracted or XORed with a character in the plaintext to produce the ciphertext, using modular arithmetic.

Keystreams are used in the one-time pad cipher and in most stream ciphers. Block ciphers can also be used to produce keystreams. For instance, CTR mode is a block mode that makes a block cipher produce a keystream and thus turns the block cipher into a stream cipher.

Read more about KeystreamExample

Other articles related to "keystream":

Keystream - Example
... The random numbers in the keystream then have to be at least between 0 and 25 ... To encrypt we add the keystream numbers to the plaintext ... And to decrypt we subtract the same keystream numbers from the ciphertext to get the plaintext ...
Stream Cipher - Loose Inspiration From The One-time Pad
... 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 ... However, the keystream must be (at least) the same length as the plaintext and be generated completely at random ...
Autokey Cipher
... A key-autokey cipher uses previous members of the keystream to determine the next element in the keystream ... previous message text to determine the next element in the keystream ...
Correlation Attack - Explanation
... between the output state of one individual LFSR in the keystream generator and the output of the Boolean function that combines the output state of all of the LFSRs ... Combined with partial knowledge of the keystream (which is easily derived from partial knowledge of the plaintext, as the two are simply XORed together), this allows an attacker to brute-force ... For instance, if, in a keystream generator in which four 8-bit LFSRs are combined to produce the keystream, and one of the registers is correlated to the ...
Solitaire (cipher) - Encryption and Decryption
... Each value of the keystream is to be used for one value of the message, thus the keystream will need to be the same length as the message ... To encrypt a message, add each keystream value to its corresponding character in the plaintext, rolling over back to 1 if the resulting value exceeds 26 (modulo 26 arithmetic) ... To decrypt, subtract each keystream value from its corresponding character in the ciphertext, rolling back up to 26 if the resulting value should be lower than 1 ...