13 Stream Cipher and Block Cipher

epgp books

 

 

 

Objective

  • To understand Stream ciphers
  • To understand the need for stream ciphers
  • To know about block ciphers
  • To learn the advantages and disadvantages of stream ciphers and block ciphers

1.    Introduction

 

A typical stream cipher encrypts plaintext one byte at a time, although a stream cipher may be designed to operate on one bit at a time or on units larger than a byte at a time. In a stream cipher, a key is input to a pseudorandom bit generator that produces a stream of 8-bit numbers that are apparently random. The output of the generator, called a keystream, is combined one byte at a time with the plaintext stream using the bitwise exclusive-OR (XOR) operation. The stream cipher is similar to the one-time pad discussed in Chapter 2. The difference is that a one-time pad uses a genuine random number stream, whereas a stream cipher uses a pseudorandom number stream. But rely on the randomness of stream key completely destroys statistically properties in message. However, you must never reuse a stream key since otherwise you can recover messages (as with a book cipher).

  1. Formal Definition of a Stream Cipher

Let E be an encipherment algorithm, and let Ek(b) be the encipherment of the message b with key k.

 

Let a message m=b1b2…where each bi is of a fixed length, and let k = k1k2….

 

A stream cipher is a cipher for which Ek(m) = Ek1 (b1)Ek2(b2)…

  1. Stream Cipher Structure

The above figure illustrates the general structure of a stream cipher, where a key is input to a pseudorandom bit generator that produces an apparently random keystream of bits, and which are XOR’d with message to encrypt it, and XOR’d again to decrypt it by the receiver.

Encryption

 

Using a secret key generate the RC4 keystream using the KSA and PRGA. Read the file and XOR each byte of the file with the corresponding keystream byte.Write this encrypted output to a file. Transmit file over an insecure channel.

 

Decryption

 

Using the same secret key used to encrypt generate the RC4 keystream.Read the encrypted file and Xor every byte of this encrypted stream with the corresponding byte of the keystream. This will yield the original plaintext

Stream Cipher Properties

 

The following lists important design considerations for a stream cipher:

 

1. The encryption sequence should have a large period, the longer the period of repeat the more difficult it will be to do cryptanalysis.

 

2. The keystream should approximate the properties of a true random number stream as close as possible, the more random-appearing the keystream is, the more randomized the ciphertext is, making cryptanalysis more difficult.

  1. To guard against brute-force attacks, the key needs to be sufficiently long. The same considerations as apply for block ciphers are valid here .Thus, with current technology, a key length of at least 128 bits is desirable.

With a properly designed pseudorandom number generator, a stream cipher can be as secure as block cipher of comparable key length. The primary advantage of a stream cipher is that stream ciphers are almost always faster and use far less code than do block ciphers. A stream cipher can be constructed with any cryptographically strong PRNG.

 

5. Stream Encryption

 

Advantages:

  • Speed of transformation: algorithms are linear in time and constant in space.
  • Low error propagation: an error in encrypting one symbol likely will not affect subsequent symbols.

Disadvantages:

  • Low diffusion: all information of a plaintext symbol is contained in a single ciphertext symbol.
  • Susceptibility to insertions/ modifications: an active interceptor who breaks the algorithm might insert spurious text that looks authentic.
  1. Block Ciphers

Block ciphers break messages into fixed length blocks, and encrypt each block using the same key. The Data Encryption Standard (DES) is an example of a block cipher, where blocks of 64 bits are encrypted using a 56-bit key.

Formal Definition of a Block Cipher

 

Let E be an encipherment algorithm, and let Ek(b) be the encipherment of the message b with key k. Let a message m=b1b2…where each bi is of a fixed length.A block cipher is a cipher for which Ek(m) = Ek(b1)Ek(b2)…

 

   7.  Block Cipher Principles

 

Block ciphers look like an extremely large substitution. It need table of 264 entries for a 64-bit block . But arbitrary reversible substitution cipher for a large block size is not practical . 64-bit general substitution block cipher, key size 264!. Most symmetric block ciphers are based on a

 

Feistel Cipher Structure .

 

An arbitrary reversible substitution cipher for a large block size is not practical, however, from an implementation and performance point of view. In general, for an n-bit general substitution block cipher, the size of the key is n x 2n. For a 64-bit block, which is a desirable length to thwart statistical attacks, the key size is 64 x 264 = 270 = 1021 bits.

Example for Real World Block Ciphers are DES, 3- DES,AES, RC-2, RC-5 , IDEA, Blowfish, Cast ,Gost etc

 

  1. Shannon and Substitution-Permutation Ciphers

Claude Shannon’s 1949 paper has the key ideas that led to the development of modern block ciphers. Critically, it was the technique of layering groups of S-boxes separated by a larger P-box to form the S-P network, a complex form of a product cipher. He also introduced the ideas of confusion and diffusion, notionally provided by S-boxes and P-boxes (in conjunction with S-boxes).

 

  9. Diffusion and Confusion

 

Introduced by Claude Shannon to thwart cryptanalysis based on statistical analysis. Assume the attacker has some knowledge of the statistical characteristics of the plaintext. Cipher needs to completely obscure statistical properties of original message. A one-time pad does this. More practically Shannon suggested combining elements to obtain:

 

diffusion – dissipates statistical structure of plaintext over bulk of ciphertext

confusion – makes relationship between ciphertext and key as complex as possible.

Every block cipher involves a transformation of a block of plaintext into a block of ciphertext, where the transformation depends on the key. The mechanism of diffusion seeks to make the statistical relationship between the plaintext and ciphertext as complex as possible in order to thwart attempts to deduce the key. Confusion seeks to make the relationship between the statistics of the ciphertext and the value of the encryption key as complex as possible, again to thwart attempts to discover the key.

 

  1. Block Encryption Advantages:
  • High diffusion: information from one plaintext symbol is diffused into several ciphertext symbols.
  • Immunity to tampering: difficult to insert symbols without

Disadvantages:

  • Slowness of encryption: an entire block must be accumulated before encryption / decryption can begin.
  • Error propagation: An error in one symbol may corrupt the entire block.

SUMMARY

  • Outlined the definitions of stream ciphers and block ciphers
  • Explained the principles of stream ciphers and block ciphers
  • Discussed advantages disadvantages of stream and block ciphers.
you can view video on Stream Cipher and Block Cipher