Posts

Substitution Ciphers-Caesar Cipher

Image
A substitution technique is one in which the letters of plaintext are replaced by other letters or by numbers or symbols.If the plaintext is viewed as a sequence of bits, then substitution involves replacing plaintext bit patterns with ciphertext bit patterns. Caesar Cipher The earliest known, and the simplest, use of a substitution cipher was by Julius Caesar.The Caesar cipher involves replacing each letter of the alphabet with the letter standing three places further down the alphabet.  For example, plain text   : meet     me   after        the      toga     party cipher text : PHHW PH DIWHU WKH WRJD SDUWB Note that the alphabet is wrapped around, so that the letter following Z is A.We can define the transformation by listing all possibilities, as follows: plain text :   a  b  c d  e  f g h  i   j   k  l  m n  o  p q  r   s  t   u  v  w x  y  z cipher text : D E F G H I J K L M N O P  Q R  S T U V W X Y  Z A  B C Let us assign a numerical equivalent to each letter: Then the algori

Playfair Cipher

Image
The best-known multiple-letter encryption cipher is the Playfair, which treats digrams in the plaintext as single units and translates these units into ciphertext digrams.The Playfair algorithm is based on the use of a 5 × 5 matrix of letters constructed using a keyword. Here is an example, solved by Lord Peter Wimsey In this case, the keyword is MONARCHY . The matrix is constructed by filling in the letters of the keyword (minus duplicates) from left to right and from top to bottom, and then filling in the remainder of the matrix with the remaining letters in alphabetic order. The letters I and J count as one letter. Plaintext is encrypted two letters at a time, according to the following rules: 1. Repeating plaintext letters that are in the same pair are separated with a filler letter, such as x , so that balloon would be treated as ba lx lo on . 2. Two plaintext letters that fall in the same row of the matrix are each replaced by the letter to the right, with the first element of

Vernam Cipher and Onetime pad

Image
The ultimate defense against such a cryptanalysis is to choose a keyword that is as long as the plaintext and has no statistical relationship to it. Such a system was introduced by an AT&T engineer named Gilbert Vernam in 1918. His system works on binary data (bits) rather than letters.The system can be expressed succinctly as follows $c_i=p_i \bigoplus k_i$ where $p_i$ i'th binary digit of plaintext $k_i$ i'th binary digit of key $c_i$ i'th binary digit of ciphertext $\bigoplus$ excilusive-or (XOR) operation Thus, the ciphertext is generated by performing the bitwise XOR of the plaintext and the key. Because of the properties of the XOR, decryption simply involves the same bitwise operation $p_i=c_i \bigoplus  k_i$ The essence of this technique is the means of construction of the key. Vernam proposed the use of a running loop of tape that eventually repeated the key, so that in fact the system worked with a very long but repeating keyword. Although such a scheme, wi

Polyalphabetic Ciphers - Vigenere Cipher

Image
Polyalphabetic Ciphers Another way to improve on the simple monoalphabetic technique is to use different monoalphabetic substitutions as one proceeds through the plaintext message. The general name for this approach is polyalphabetic substitution cipher. All these techniques have the following features in common: 1. A set of related monoalphabetic substitution rules is used. 2. A key determines which particular rule is chosen for a given transformation Vignere Cipher The Vigenère cipher is a classic method of encrypting alphabetic text by using a simple form of polyalphabetic substitution. It was originally described by Giovan Battista Bellaso in 1553, but it was later misattributed to Blaise de Vigenère, who developed a related but more complex cipher. The Vigenère cipher was considered unbreakable for centuries until it was cryptanalyzed in the 19th century. Key Features Polyalphabetic Substitution : Uses multiple Caesar ciphers based on the letters of a keyword, making it more re

Hill Cipher

Another interesting multi letter cipher is the Hill cipher, developed by the mathematician Lester Hill in 1929. THE HILL ALGORITHM  This encryption algorithm takes $n$ successive plaintext letters and substitutes for them $n$ ciphertext letters. The substitution is determined by linear equations in which each character is assigned a numerical value $(a=0,b=1,\ldots,z=25)$.  $C=KP$, where  $K$ is the key matrix and $P$ is the plaintext vector $P=K^{-1}C$, where $K^{-1}$ is the inverse of key matrix $K$ in $\pmod{26}$ How the Hill Cipher Works Key Matrix : Choose a key matrix K of size n × n n \times n  (e.g., 2 × 2 2 \times 2 , 3 × 3 3 \times 3 ). The key matrix should be invertible modulo 26 (the number of letters in the English alphabet). Plaintext Preparation : Convert the plaintext into vectors of size n n . If the plaintext length is not a multiple of n n , pad it with extra letters (e.g., 'X'). Encryption : Multiply the key matrix K K  by each plaintext vector, and ta

Data Encryption Standard - DES Algorithm

Image
The Data Encryption Standard (DES) was the most widely used encryption scheme. DES was issued in 1977 by the National Bureau of Standards, now the National Institute of Standards and Technology (NIST), as Federal Information Processing Standard 46 (FIPS PUB 46). The algorithm itself is referred to as the Data Encryption Algorithm (DEA). For DEA, data are encrypted in 64-bit blocks using a 56-bit key. The algorithm transforms 64-bit input in a series of steps into a 64-bit output. The same steps, with the same key, are used to reverse the encryption. Key Concepts of DES Symmetric Key Algorithm : In DES, the same key is used for both encryption and decryption . This key must be shared between the sender and receiver securely. Block Cipher : DES operates on fixed-length groups of bits, called blocks . The block size for DES is 64 bits . The input data is divided into 64-bit blocks, which are encrypted one block at a time. Key Length : DES uses a 56-bit key (though 64 bits are supplie

Transposition Ciphers

Image
All the techniques examined so far involve the substitution of a ciphertext symbol for a plaintext symbol. A very different kind of mapping is achieved by performing some sort of permutation on the plaintext letters. This technique is referred to as a transposition cipher. The simplest such cipher is the rail fence technique, in which the plaintext is written down as a sequence of diagonals and then read off as a sequence of rows. For example, to encipher the message “meet me after the toga party” with a rail fence of depth 2, we write the following: m      e      m    a    t      r      h      t      g      p      r      y      e      t      e      f      e      t      e      o      a      a      t The encrypted message is MEMATRHTGPRYETEFETEOAAT This sort of thing would be trivial to cryptanalyze.A more complex scheme is to write the message in a rectangle, row by row, and read the message off, column by column, but permute the order of the columns. The order of the columns then