PMIT-6204:: Cryptography & Steganography

Download as pdf or txt
Download as pdf or txt
You are on page 1of 21

PMIT-6204: Cryptography & Steganography

for

Traditional Transposition Ciphers


Prepared by:
Professor K M Akkas Ali
[email protected], [email protected]

Institute of Information Technology (IIT)


Jahangirnagar University, Dhaka-1342
IIT, JU
Lecture File-06:
Traditional Transposition Ciphers
Topics to be Discussed

Prepared by: K M Akkas Ali, Professor, IIT, JU


To define transposition ciphers:
To illustrate some transposition ciphers:
❑ Keyless cipher
❑ Keyed cipher
❑ Columnar cipher
To introduce the concepts of the stream
ciphers and block ciphers

Slide- 2 IIT, JU
Transposition Ciphers

What is Transposition Ciphers

  A transposition cipher does not substitute one symbol for another,


instead it changes the location of the symbols.
 

Prepared by: K M Akkas Ali, Professor, IIT, JU


A symbol in the first position of the plaintext may appear in the ninth
position of the ciphertext. A symbol in the eighth position of the
plaintext may appear in the first position of the ciphertext.

Types of Transposition Ciphers

There are three types of transposition cipher:


- Keyless Transposition Ciphers
- Keyed Transposition Ciphers

- Keyed Columnar Transposition Ciphers or Columnar Transposition Ciphers

Slide- 3 IIT, JU
Slide- 4

Prepared by: K M Akkas Ali, Professor, IIT, JU


IIT, JU
Keyless Transposition Ciphers

These are simple transposition ciphers and were used in the past.

There are two methods for permutation of characters:

Prepared by: K M Akkas Ali, Professor, IIT, JU


In the first method, the text is written into a table column by
column and then transmitted row by row.

In the second method, the text is written into a table row by


row and then transmitted column by column.

Slide- 5 IIT, JU
Keyless Transposition Ciphers
Example:
1st Method: Written column by column and transmitted row by row
  A good example of a keyless cipher using the first method is the rail
fence cipher.

Prepared by: K M Akkas Ali, Professor, IIT, JU


  In this cipher, the plaintext is arranged in two lines as a zigzag pattern
(which means column by column).
  The ciphertext is created reading the pattern row by row. For example, to
send the message “Meet me at the park” to Bob, Alice writes-

By sending the first row followed by the second row, Alice then creates the ciphertext
“MEMATEAKETETHPR”.
Bob receives the ciphertext and divides in half (in this example, the second half has
one less character). The first half forms the first row; the second half forms the
second row. She reads the result in zigzag.
Because there is no key and the number of rows is fixed (2 here), the cryptanalysis of
the ciphertext would be very easy for Eve.
Slide- 6 IIT, JU
Keyless Transposition Ciphers
Example:
2nd Method: Written row by row and transmitted column by column
  Alice and Bob can agree on the number of columns and use the second
method. Alice writes the same plaintext, row by row, in a table of four

Prepared by: K M Akkas Ali, Professor, IIT, JU


columns.

By transmitting the characters column by column, Alice then creates the ciphertext
“MMTAEEHREAEKTTP”.
Bob receives the ciphertext and follows the reverse process. He writes the received
message column by column and reads it row by row as the plaintext.
Eve can easily decipher the message if she knows the number of columns.

Slide- 7 IIT, JU
Keyless Transposition Ciphers
Example:
The cipher in the previous example is actually a transposition cipher. The
following shows the permutation of each character in the plaintext into the
ciphertext based on the positions.

Prepared by: K M Akkas Ali, Professor, IIT, JU


Plaintext : m e e t m e a t t h e p a r K
Source Position : 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
                             
Destination Position
: 01 05 09 13 02 06 10 14 03 07 11 15 04 08 12
Ciphertext : M M T A E E H R E A E K T T P

  The first character in the plaintext has not changed its position. The
second character in the plaintext has moved to the fifth position in the
ciphertext; the third character has moved to the ninth position; and so on.
  Although the characters are permuted, there is a pattern in the
permutation: (01, 05, 09, 13), (02, 06, 10, 14), (03, 07, 11, 15), and (04,
08, 12). In each section, the difference between the two adjacent numbers
Slide- 8
is 4. IIT, JU
Keyed Transposition Ciphers

  The keyless ciphers permute the characters by using writing


plaintext in one way (e.g. row by row) and reading it in another
way (e.g. column by column). The permutation is done on the
whole plaintext to create the whole ciphertext.

Prepared by: K M Akkas Ali, Professor, IIT, JU


  In keyed transposition cipher, the plaintext is divided into
groups of predetermined size, called blocks, and then use a key
to permute the characters in each block separately.

Slide- 9 IIT, JU
Keyed Transposition Ciphers
Example:
❑ Alice needs to send the message “Enemy attacks tonight” to Bob.
❑ They have agreed to divide the text into groups of five characters and then
permute the characters in each group.

Prepared by: K M Akkas Ali, Professor, IIT, JU


To make the last group the same size, a bogus character z is added at the end.

The key used for encryption and decryption is a permutation key, which shows how
the character are permuted. For the above message, we assume that Alice and Bob
used the following key:
The third character in the plaintext
block becomes the first character in
the ciphertext block. Similarly, the first character in the plaintext block becomes
the second character in the ciphertext block , and so on.
The permutation yields:

Alice sends the ciphertext “EEMYNTAACTTKONSHITZG” to Bob. Bob divides


the ciphertext into 5-character groups and finds the plaintext using the key in
Slide-reverse
10 order. IIT, JU
Columnar Transposition Ciphers

  This type of transposition cipher combines the keyless and


keyed transposition ciphers to achieve better scrambling.
  Encryption or decryption is done in three steps:

Prepared by: K M Akkas Ali, Professor, IIT, JU


1. The text is written into a table row by row.
2. The permutation is done by reordering the columns.
3. The new table is read column by column.
  Here, the 1st and 3rd steps provide a keyless global reordering
and the 2nd step provides a blockwise keyed reordering.

Slide- 11 IIT, JU
Columnar Transposition Ciphers
Example:
Encrypt the message “enemy attacks tonight” using Columnar
transposition cipher.
Solution: The encryption and decryption is illustrated in the figure below.

Prepared by: K M Akkas Ali, Professor, IIT, JU


▪ The 1st table in the
figure is created by
Alice writing the
plaintext row by
row.
▪ The columns are
permuted using
the key mentioned.

▪ The ciphertext is
created by reading
the 2nd table
column by column.

▪ Bob does the same


three steps in the
reverse order.

Slide- 12
Figure: Combining Two Approaches IIT, JU
Columnar Transposition Ciphers

Keys

  In the previous example, a single key was used in two directions for
the column exchange:
❑ downward for encryption

Prepared by: K M Akkas Ali, Professor, IIT, JU


❑ upward for decryption.

  It is customary to create two keys.

Figure: Encryption/decryption keys in transpositional ciphers

Slide- 13 IIT, JU
Key inversion in a transposition cipher

  How can the inverse of a key be created if the initial or original key is
given, or vice versa?
  The process can be done manually in a few steps.
  Figure below shows how to invert an encryption key, i.e. how to find the

Prepared by: K M Akkas Ali, Professor, IIT, JU


decryption key.

Figure: Inverting a permutation table

Slide- 14 IIT, JU
Columnar Transposition Ciphers
Using Matrices
  We can use matrices to show the encryption/decryption process for a
transposition cipher.
  Figure below shows the encryption process.

Prepared by: K M Akkas Ali, Professor, IIT, JU


  Multiplying the 4 × 5 plaintext matrix by the 5 × 5 encryption key gives
the 4 × 5 ciphertext matrix.

Figure: Representation of the key as a matrix in the transposition cipher


Slide- 15 IIT, JU
Double Transposition Ciphers
Example:

Prepared by: K M Akkas Ali, Professor, IIT, JU


Figure: Double transposition cipher

Slide- 16 IIT, JU
Traditional Vs. Modern Symmetric-key Ciphers:
  The traditional symmetric-key ciphers were used in the past. They
are character-oriented ciphers.
  Traditional ciphers are simpler than modern ciphers and easier to
understand. They can be easily attacked using a computer.

Prepared by: K M Akkas Ali, Professor, IIT, JU


  Two broad categories of traditional symmetric-key ciphers are:
❑ Traditional substitution ciphers
❑ Traditional transposition ciphers

  Now-a-days, the information to be encrypted is not just text; it can


also consist of numbers, graphics, audio, and video data. It is
convenient to convert these types of data into a stream of bits, to
encrypt the stream, and then to send the encrypted stream. So, we
need bit-oriented ciphers.
  When data is treated as the collection of bits, it becomes larger.
Mixing a larger number of symbols increases security.
  Two broad categories of modern symmetric-key ciphers are:
❑ Modern stream ciphers
❑ Modern block ciphers
Slide-17 IIT, JU
Stream Ciphers:
  Stream cipher encrypts a single character or bit of plaintext at a
time. It also decrypts a single character or bit of ciphertext at a time.

Example:
  Given plaintext: 10011011110100001

Prepared by: K M Akkas Ali, Professor, IIT, JU


Let the keystream be a stream of 1s and 0s.
  If we use an exclusive or (XOR) with the keystream and plaintext, we
get ciphertext.
  This keystream is called periodic, since the sequence '10' repeats over
and over.

Plaintext : 10011011110100001
Keystream : 10101010101010101
Ciphertext : 00110001011110100 (by XORing each plaintext bit with corresponding keystream bit)

  To decrypt this ciphertext, all we need to do is again XOR the


ciphertext with the keystream:
Ciphertext : 00110001011110100
Keystream : 10101010101010101
Plaintext (XOR) : 10011011110100001
Slide-18 IIT, JU
Block Ciphers:
  A symmetric-key modern block cipher encrypts an
n-bit block of plaintext or decrypts an n-bit block of ciphertext
together.
  The decryption algorithm must be the inverse of the encryption
algorithm.

Prepared by: K M Akkas Ali, Professor, IIT, JU


  If the message has the fewer than n bits, padding must be added to
make it an n-bit block. If the message has more than n bits, it should
be divided into n-bit blocks and the appropriate padding must be
added to the last block if necessary.
  The common values of n are 64, 128, 256, or 512 bits.

Example
Plaintext : The only thing we have to fear is fear itself

Modified plaintext : Theonlythingwehavetofearisfearitself

Plaintext blocks : Theonlyt hingweha vetofear isfearit selfXend (break the plaintext into 8-character block)

Ciphertext blocks : tylnoehT ahewgnih raefotev tiraefsi dneXfles (just reverse each plaintext block)

Ciphertext : tylnoehTahewgnihraefotevtiraefsidneXfles
Slide-19 IIT, JU
Discussion Points

To define transposition ciphers:

Prepared by: K M Akkas Ali, Professor, IIT, JU


To illustrate some transposition ciphers:
❑ Keyless cipher
❑ Keyed cipher
❑ Columnar cipher
To introduce the concepts of the stream
ciphers and block ciphers

Slide-20 IIT, JU
Slide-21
Thank you…
Have a question?

Prepared by: K M Akkas Ali, Professor, IIT, JU


IIT, JU

You might also like