Encryption and Decryption with Stream Ciphers

This blog will introduce the first type of the symmetric cipher, which is known as “Stream Ciphers“.

stream-cipher-tree

 

The figure below shows the encryption and decryption process in stream ciphers:

Note: Plaintext = xi, Ciphertext = yi & key stream = si.

screen-shot-2017-02-17-at-10-03-22-am

Encryption and decryption are same functions, where they are simple additions modulo 2 (XOR).

Encryption:  yi = esi(xi) = xi + si mod 2
Decryption: xi = dsi(yi) = yi + si mod 2

Note: xi , yi & si ∈ {0,1}.

 

The question is – What is the difference between the key (k) and the key stream (s)The key is used to encrypt and decrypt the message and it is only known only by the sender and the receiver. The key stream, on the other hand, is the result of the XORed key and generated from the original key. Usually, the original key goes through a process called “key stream generator” to generate the key stream.

 

Before we get deep into the process of key stream generator, let’s have a look at the of XOR operation. XOR operation is equivalent to modulo 2 addition. This is good for perfectly random key stream (si), where each ciphertext output bit has a chance of 50% to be either (0 or 1). Also, inverting the XOR is simple, since it is the same XOR operation.

screen-shot-2017-02-17-at-10-11-52-am

 

The figure below shows the process of generating the key stream.

screen-shot-2017-02-17-at-10-03-32-am

The security of stream cipher depends entirely on the key stream (si), where it should be:

  • Should be random.
  • Must be reproducible by sender and receiver.

 

Stream ciphers can be either Synchronous Stream Cipher or Asynchronous Stream Cipher. The difference is that the Synchronous Stream Cipher the key stream (si) depends only on the key (k). However, Asynchronous Stream Cipher the key stream (si) depends on both the key (k) and the ciphertext.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s