Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Keystream

From Wikipedia, the free encyclopedia
Concept in cryptography

Incryptography, akeystream is astream ofrandom orpseudorandom characters that are combined with aplaintext message to produce an encrypted message (the ciphertext).

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

Usually each character in the keystream is either added, subtracted orXORed with a character in the plaintext to produce the ciphertext, usingmodular arithmetic.

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

Example

[edit]

In this simple example we use the English alphabet of 26 characters from a-z. Thus we can not encrypt numbers, commas, spaces and other symbols. 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.

If a ciphertext number becomes larger than 25 we wrap it to a value between 0-25. Thus 26 becomes 0 and 27 becomes 1 and so on. (Such wrapping is calledmodular arithmetic.)

Here the plaintext message "attack at dawn" is combined by addition with the keystream "kjcngmlhylyu" and produces the ciphertext "kcvniwlabluh".

Plaintextattackatdawn
Plaintext as numbers019190210019302213
Keystreamkjcngmlhylyu
Keystream as numbers10921361211724112420
Ciphertext as numbers10282113822112627114633
Ciphertext as numbers
wrapped to 0-25
1022113822110111207
Ciphertext as textkcvniwlabluh

References

[edit]


Widely used ciphers
eSTREAM Portfolio
Software
Hardware
Other ciphers
Generators
Theory
Attacks
General
Mathematics
Retrieved from "https://en.wikipedia.org/w/index.php?title=Keystream&oldid=1136438276"
Category:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp