Unit-1B
Presented by :
                              Prof Ghanshyam I Prajapati
                              Dept of CE & IT,
                              SVMIT - Bharuch
16-Feb-23    CNS (3161606)                                 1
            Important Key Points…..
• 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.
16-Feb-23                  CNS (3161606)                        2
            Symmetric Cipher Model
16-Feb-23            CNS (3161606)   3
• There are two requirements for secure use of conventional
  encryption:
1. We need a strong encryption algorithm. At a minimum, we
   would like the algorithm to be such that an opponent who
   knows the algorithm and has access to one or more ciphertexts
   would be unable to decipher the ciphertext or figure out the
   key. This requirement is usually stated in a stronger form: The
   opponent should be unable to decrypt ciphertext or discover
   the key even if he or she is in possession of a number of
   ciphertexts together with the plaintext that produced each
   ciphertext.
2. Sender and receiver must have obtained copies of the secret
   key in a secure fashion and must keep the key secure. If
   someone can discover the key and knows the algorithm, all
   communication using this key is readable.
16-Feb-23                    CNS (3161606)                       4
16-Feb-23   CNS (3161606)   5
Cryptographic systems are characterized along three independent dimensions:
1. The type of operations used for transforming plaintext to ciphertext.
            All encryption algorithms are based on two general principles:
       substitution, in which each element in the plaintext (bit, letter, group of
       bits or letters) is mapped into another element, and transposition, in which
       elements in the plaintext are rearranged. The fundamental requirement is
       that no information be lost (i.e., that all operations are reversible). Most
       systems, referred to as product systems, involve multiple stages of
       substitutions and transpositions.
2. The number of keys used.
            If both sender and receiver use the same key, the system is referred to
    as symmetric, single-key, secret-key, or conventional encryption. If the
    sender and receiver use different keys, the system is referred to as
    asymmetric, two-key, or public-key encryption.
3. The way in which the plaintext is processed.
    A block cipher processes the input one block of elements at a time,
    producing an output block for each input block. A stream cipher processes
    the input elements continuously, producing output one element at a time, as
    it goes along.
16-Feb-23                           CNS (3161606)                                 6
Cryptanalysis:
         Cryptanalytic attacks rely on the nature of the algorithm
    plus perhaps some knowledge of the general characteristics of
    the plaintext or even some sample plaintext–ciphertext pairs.
    This type of attack exploits the characteristics of the algorithm
    to attempt to deduce a specific plaintext or to deduce the key
    being used.
Brute-force attack:
         The attacker tries every possible key on a piece of
    ciphertext until an intelligible translation into plaintext is
    obtained. On average, half of all possible keys must be tried to
    achieve success.
16-Feb-23                      CNS (3161606)                            7
    Types of Attacks on Encrypted Messages
16-Feb-23           CNS (3161606)            8
• An encryption scheme is unconditionally secure if the
  ciphertext generated by the scheme does not contain
  enough information to determine uniquely the corres-
  ponding plaintext, no matter how much ciphertext is
  available.
• Therefore, all that the users of an encryption algorithm
  can strive for is an algorithm that meets one or both of the
  following criteria:
    (1) The cost of breaking the cipher exceeds the value of
        the encrypted information.
   (2) The time required to break the cipher exceeds the
        useful lifetime of the information.
• An encryption scheme is said to be computationally
  secure if either of the foregoing two criteria are met.
16-Feb-23                  CNS (3161606)                     9
• The two basic building blocks of all encryption
  techniques are :
            ** substitution
            ** transposition.
16-Feb-23                     CNS (3161606)     10
                 Substitution Techniques
• 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.
• Different Flavors:
      –     Caesar Cipher
      –     Monoalphabetic Ciphers
      –     Playfair Cipher
      –     Hill Cipher
      –     Polyalphabetic Ciphers
      –     One-Time Pad
16-Feb-23                       CNS (3161606)                   11
                 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
16-Feb-23               CNS (3161606)                   12
16-Feb-23   CNS (3161606)   13
            Monoalphabetic Ciphers
• Better than Caeser Cipher
• For each character of alphabet, assign different-abrupt
  concerned character
• Example:
  a – P, b-Y, c-E, …. z-Q etc…
• Monoalphabetic ciphers are easy to break because
  they reflect the frequency data of the original
  alphabet.
• A countermeasure is to provide multiple substitutes,
  known as homophones, for a single letter.
16-Feb-23                CNS (3161606)                   14
                 Playfair Cipher
• 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.
• 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.
16-Feb-23                CNS (3161606)                 15
                                       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 the row
    circularly following the last. For example, ar is encrypted as RM.
3. Two plaintext letters that fall in the same column are each replaced by
   the letter beneath, with the top element of the column circularly
   following the last. For example, mu is encrypted as CM.
4. Otherwise, each plaintext letter in a pair is replaced by the letter that
   lies in its own row and the column occupied by the other plaintext
   letter. Thus, hs becomes BP and ea becomes IM (or JM, as the
  16-Feb-23                            CNS (3161606)                         16
   encipherer wishes).
• The Playfair cipher is a great advance over simple
  monoalphabetic ciphers.
• For one thing, whereas there are only 26 letters, there
  are 26 * 26 = 676 digrams, so that identification of
  individual digrams is more difficult.
16-Feb-23                CNS (3161606)                  17
                      Hill Cipher
• This encryption algorithm takes m successive
  plaintext letters and substitutes for them m
  ciphertext letters.
• The substitution is determined by m linear
  equations in which each character is assigned a
  numerical value (a = 0, b = 1, c, z = 25).
• For m = 3, the system can be described as
            c1 = (k11p1 + k21p2 + k31p3) mod 26
            c2 = (k12p1 + k22p2 + k32p3) mod 26
            c3 = (k13p1 + k23p2 + k33p3) mod 26
16-Feb-23                   CNS (3161606)         18
• As with Playfair, the strength of the Hill cipher is that it
     completely hides single-letter frequencies. Indeed, with Hill, the
     use of a larger matrix hides more frequency information.
• Thus, a 3 * 3 Hill cipher hides not only single-letter but also two-
     letter frequency information.
• Although the Hill cipher is strong against a ciphertext-only
     attack, it is easily broken with
16-Feb-23
                                       a known plaintext attack.
                                  CNS (3161606)                         19
16-Feb-23   CNS (3161606)   20
16-Feb-23   CNS (3161606)   21
                 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.
16-Feb-23                  CNS (3161606)                     22
16-Feb-23   CNS (3161606)   23
16-Feb-23   CNS (3161606)   24
16-Feb-23   CNS (3161606)   25
            One-Time Pad
16-Feb-23      CNS (3161606)   26
• In theory, we need look no further for a cipher. The one-time pad
  offers complete security but, in practice, has two fundamental
  difficulties:
  1. There is the practical problem of making large quantities of
     random keys. Any heavily used system might require millions
     of random characters on a regular basis. Supplying truly random
     characters in this volume is a significant task.
  2. Even more daunting is the problem of key distribution and
     protection. For every message to be sent, a key of equal length
     is needed by both sender and receiver. Thus, a mammoth key
     distribution problem exists.
• Because of these difficulties, the one-time pad is of limited utility
  and is useful primarily for low-bandwidth channels requiring very
  high security.
• The one-time pad is the only cryptosystem that exhibits what is
  referred to as perfect secrecy.
 16-Feb-23                      CNS (3161606)                        27
            Transposition Techniques
• 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:
16-Feb-23                  CNS (3161606)                        28
16-Feb-23   CNS (3161606)   29
16-Feb-23   CNS (3161606)   30
16-Feb-23   CNS (3161606)   31
                    Rotor Machines
• The example just given suggests that multiple stages of
  encryption can produce an algorithm that is significantly
  more difficult to cryptanalyze.
• This is as true of substitution ciphers as it is of transposition
  ciphers.
• The basic principle of the rotor machine is illustrated in
  figure.
• The machine consists of a set of independently rotating
  cylinders through which electrical pulses can flow.
• Each cylinder has 26 input pins and 26 output pins, with
  internal wiring that connects each input pin to a unique
  output pin. For simplicity, only three of the internal
  connections in each cylinder are shown.
 16-Feb-23                    CNS (3161606)                      32
16-Feb-23   CNS (3161606)   33
16-Feb-23   CNS (3161606)   34
                    Steganography
A plaintext message may be hidden in one of two ways. The
  methods of steganography conceal the existence of the
  message, whereas the methods of cryptography render the
  message unintelligible to outsiders by various transformations
  of the text.
Various other techniques have been used historically; some
  examples are the following :
Character marking: Selected letters of printed or typewritten
  text are overwritten in pencil. The marks are ordinarily not
  visible unless the paper is held at an angle to bright light.
Invisible ink: A number of substances can be used for writing
  but leave no visible trace until heat or some chemical is
  applied to the paper.
16-Feb-23                    CNS (3161606)                        35
Pin punctures: Small pin punctures on selected letters are
  ordinarily not visible unless the paper is held up in front of a
  light.
Typewriter correction ribbon: Used between lines typed with a
  black ribbon, the results of typing with the correction tape are
  visible only under a strong light.
• Steganography has a number of drawbacks when compared to
     encryption. It requires a lot of overhead to hide a relatively few
     bits of information, although using a scheme like that proposed in
     the preceding paragraph may make it more effective.
• Also, once the system is discovered, it becomes virtually
     worthless. This problem, too, can be overcome if the insertion
     method depends on some sort of key.
• Alternatively, a message can be first encrypted and then hidden
     using steganography.
 16-Feb-23                        CNS (3161606)                        36
• The advantage of steganography is that it can be
  employed by parties who have something to lose should
  the fact of their secret communication (not necessarily the
  content) be discovered.
• Encryption flags traffic as important or secret or may
  identify the sender or receiver as someone with something
  to hide.
16-Feb-23                  CNS (3161606)                    37