Why stream cipher produces different ciphertext evertime it is invoked on the same plaintext?

245 views Asked by At

I read this statement on the book: "Applied Cryptography":

With a blocker cipher, the same plaintext block will always encrypt to the same ciphertext block, using the same key. With a stream cipher, the same plaintext bit or byte will encrypt to a different bit or byte every time it is encrypted.

I don't understand why stream cipher will encrypt to different ciphertext for the same plaintext, does it mean every time stream cipher is invoked, it will use a different key to encrypt the plaintext? or else how come the same plain text encrypts to different ciphertext? And if the encryption key changes every time the encryption occurs, how can sender and receiver sync on which key to use?

thanks.

1

There are 1 answers

1
Sung Yokato On

It works by using random numbers to shuffle the message at every iteration over the characters of the plaintext and the hash stream of the key, So the result is aways different even for the same plaintext and key every time you invoke it. But you can use the same key to decrypt it, even for different ciphertexts. That looks 'magic' but it's just math.

You can see a working example of that here: https://github.com/SungYokato/xorpher