CRYPTOGRAPHY CONCEPTS AND TECHNIQUES
• We define some terms. An original message is known as the
  plaintext, while the coded message is called the ciphertext.
• The process of converting from plaintext to ciphertext is known as
  enciphering or encryption;
• Restoring the plaintext from the ciphertext is deciphering or
  decryption.
• The many schemes used for encryption constitute the area of study
  known as cryptography.
• Such a scheme is known as a cryptographic system or a cipher.
  Techniques used for deciphering a message without any knowledge
  of the enciphering details fall into the area of cryptanalysis.
• Cryptanalysis is what the layperson calls “breaking the code.” The
  areas of cryptography and cryptanalysis together are called
  cryptology.
              SYMMETRIC CIPHER MODEL
• Plaintext: This is the original intelligible message or data that is fed
  into the algorithm as input.
• Encryption algorithm: The encryption algorithm performs various
  substitutions and transformations on the Plaintext.
• Secret key: The secret key is also input to the encryption algorithm.
  The key is a value independent of the plaintext and of the algorithm.
  The algorithm will produce a different output depending on the specific
  key being used at the time. The exact substitutions and transformations
  performed by the algorithm depend on the key.
• Ciphertext: This is the scrambled message produced as output. It
  depends on the plaintext and the secret key. For a given message, two
  different keys will produce two different ciphertexts. The ciphertext is
  an apparently random stream of data and, as it stands, is unintelligible.
• Decryption algorithm: This is essentially the encryption algorithm
  run in reverse. It takes the ciphertext and the secret key and produces
  the original plaintext.
SYMMETRIC CIPHER
                     CRYPTANLYTIC ATTACKS
•A cryptanlytic attacks are done generally by
cryptanalysis or by brute force attcks.
•There are several ways for attack for cryptanalyst.
1. Ciphertext Only
2. Known Plaintext
3. Chosen Plaintext
4. Chosen Ciphertext
5. Chosen Text
• The details about the above attacks are given
   below.
                     SUBSTITUTION TECHNIQUES
• The two basic building blocks of all encryption
  techniques are substitution and transposition.
substitution
• 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.
• We Discuss about few substitution techniques
  below.
                 SUBSTITUTION TECHNIQUES
•Caeser cipher
•Monoalphabetic cipher
•Playfair cipher
•Hill cipher
•Polyalphabetic cipher
                            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: meet me after the toga party
• cipher: 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: 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: 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:
                Caesar cipher
• Representation of alphabets
                 Caesar cipher
• Then the algorithm can be expressed as follows.
  For each plaintext letter p, substitute the
  ciphertext letter C:2
• C = E(3, p) = (p + 3) mod 26
• A shift may be of any amount, so that the general
  Caesar algorithm is
• C = E(k, p) = (p + k) mod 26
• where k takes on a value in the range 1 to 25. The
  decryption algorithm is simply
• p = D(k, C) = (C - k) mod 26
                 Caesar cipher
• If it is known that a given ciphertext is a Caesar
  cipher, then a brute-force cryptanalysis is easily
  performed: simply try all the 25 possible keys.
• Three important characteristics of this problem
  enabled us to use a brute-force cryptanalysis:
• 1. The encryption and decryption algorithms are
  known.
• 2. There are only 25 keys to try.
• 3. The language of the plaintext is known and
  easily recognizable.
                         EXAMPLE
•   KEY K=5
•   WORD = NEW
•   N value is 13 C=(13+5) mod 26 = 18 is ‘S’
•   E value is 4 C=(4+5) mod 26 = 9 is ‘J’
•   W value is 22 C =(22+5)mod 26 =1 is ‘B’
•   For NEW the cipher text is SJB.
•   Caeser cipher also callesd as additive ciphers or
    shift ciphers.
    MONOALPHABETIC SUBSTITUTION CIPHER
•In monoalphabetic substitution the relation ship between a
symbol in the plain text to a symbol in the cipher text is always
one-to-one.
•After sender and receiver agreed to a single key that key is
used to encrypt each letter in the plain text or decrypt each
letter in the cipher text.
•A better solution is to create a mapping between each plain
text character and corresponding cipher text character.
•An example key for monoalphabetic cipher.
Plain Text
abcdefghIjklmnopqrstuvwxyz
Cipher text
noatrbecfuxdqgylkhvIjmpzsw
  MONOALPHABETIC SUBSTITUTION CIPHER
• With only 25 possible keys, the Caesar cipher is far from
secure.
• A dramatic increase in the key space can be achieved by
allowing an arbitrary substitution.
• Before proceeding, we define the term permutation.
• A permutation of a finite set of elements S is an ordered
sequence of all the elements of S, with each element
appearing exactly once.
• For example, if S = {a, b, c}, there are six permutations of S:
abc, acb, bac, bca, cab, cba.
• In general, there are n! permutations of a set of n elements,
because the first element can be chosen in one of n ways,
the second in n - 1 ways, the third in n – 2 ways, and so on.
  MONOALPHABETIC SUBSTITUTION CIPHER
EX: Message : encrypt
Plain text : encrypy
Ciphertext : rgahsli
                PLAYFAIR CIPHER
•After completion of this session. Students will
learn about
•Understand the basic working of playfair cipher
•Know about diagrams and generation of diagrams
with/without filter characters.
•This cipher is also called as wheatstone playfair
cipher.
•This cipher is manual symmetric encryption
technique.
            PLAYFAIR CIPHER contd..
•This cipher is multiple letter encryption cipher.
•In this cipher plain text alphabets are split as
diagrams.
•This technique uses 5*5 matrix constructed using a
keyword (EX: Monarchy).
              M     O      N     A      R
              C     H      Y     B      D
              E     F      G     I/J    K
              L     P      Q     S      T
              U     V      W     X      Z
          PLAYFAIR CIPHER contd..
• Here the key is MONARCHY. We can take any
other key also.
•In 5*5 matrix we can enter non repeated words.
•I and J occupies same cell.
Rules for encryption using playfair cipher.
1. Diagrams
2. Repeating letter-filter it
3. Same column select immediate down element
    ↓ wrap around.
4. Same row select immediate right element →
    wrap around
5. Rectangle ⇆ swap
                      EXAMPLE
•Plain text: ATTACK
•Diagram : AT TA       CK
           EXAMPLE-2
• MOSQUE
HILL CIPHER
          POLYALPHABETIC CIPHER
• 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.
• Polyalphabetic substitution ciphers are
1. Vigenere cipher
2. One-time pad cipher
VIGENERE CIPHER
                One Time Pad
• In cryptography, a one-time pad is a system in which
  a randomly generated private key is used only once
  to encrypt a message that is then decrypted by the
  receiver using a matching one-time pad and key.
• One-time pad cipher is a type of Vignere cipher which
  includes the following features −
• It is an unbreakable cipher.
• The key is exactly same as the length of message which
  is encrypted.
• The key is made up of random symbols.
• As the name suggests, key is used one time only and
  never used again for any other message to be
  encrypted.
          One Time Pad contd..
• Due to this, encrypted message will be vulnerable to
  attack for a cryptanalyst. The key used for a one-time
  pad cipher is called pad, as it is printed on pads of
  paper.
Encryption
• To encrypt a letter, a user needs to write a key
  underneath the plaintext.
• The plaintext letter is placed on the top and the key
  letter on the left.
• The cross section achieved between two letters is the
  plain text.
• It is described in the example in the next slide.
One Time Pad contd..
         One Time Pad contd..
Decryption
• To decrypt a letter, user takes the key letter on
  the left and finds cipher text letter in that row.
• The plain text letter is placed at the top of the
  column where the user can find the cipher
  text letter.
                  TRANSPOSTION TECHNIQUES
• Transposition Cipher is a cryptographic
  algorithm where the order of alphabets in
  the plaintext is rearranged to form a cipher
  text.
• In this process, the actual plain text alphabets
  are not included.
• We are considering two techniques
1. Rail-Fence Technique
2. Simple columnar transposition techniques
                         RAIL FENCE
• Rail-Fence is the simple Transposition technique that involves writing
  plain text as a sequence of diagonals and then reading it row by row
  to produce the ciphertext.
• Now read the plain text by row-wise, i.e. croaerdeoprtbig.
• So, here the plain text is a corporate bridge, and ciphertext is
  croaerdeoprtbig
  Simple columnar transposition techniques
• The simple columnar transposition technique
  can be categorized into two parts – Basic
  technique and multiple rounds.
• Simples columnar transposition technique –
  basic technique.
• The simple columnar transposition technique
  simply arranges the plain text in a sequence of
  rows of a rectangle and reads it in a columnar
  manner.
               ALGORITHM
• Step 1: Write all the characters of plain text
  message row by row in a rectangle of
  predefined size.
• Step 2: Read the message in a columnar
  manner, i.e. column by column.
• Note: For reading the message, it needs not to
  be in the order of columns. It can happen in
  any random sequence.
• Step 3: The resultant message is ciphertext.
                  Example
• Let’s assume that Plain text is a corporate
  bridge, and we need to calculate the cipher
  text using a simple columnar transposition
  technique.
• Let’s take 6 columns and arrange the plain text
  in a row-wise manner.
• The Table is taken as in the next slide.
                  Example contd..
COLUMN-1   COLUMN-2   COLUMN-3   COLUMN-4   COLUMN-5   COLUMN-6
   C          O          R          P          O          R
   A          T          E          B          R          I
   D          G          E
Decide the column order for reading the message – let’s
assume 1,3,5,2,4,6 is an order.
Now read the message in a columnar manner using the
decided order. – cadreeorotgpbri
cadreeorotgpbri is a ciphertext.
                      Steganography
• The purpose of steganography is to conceal
  and deceive.
• It is a form of coverting communication and
  can involve the use of any medium to hide
  messages.
• It's not a form of cryptography, because it
  doesn't involve scrambling data or using a
  key.
• Instead, it is a form of data hiding and can be
  executed in clever ways.
Types of Steganography techniques
• Depending on the nature of the cover
  object(actual object in which secret data is
  embedded), steganography can be divided
  into five types:
• Text Steganography.
• Image Steganography.
• Video Steganography.
• Audio Steganography.
• Network Steganography.