c3_l3 by cuiliqing

VIEWS: 14 PAGES: 90

									C
lassical
    &
ontempory
ryptology




            Cryptology
             Lecture Three

              Dr. Richard Spillman
            Pacific Lutheran University
                                          1
C
    lassical
        &
    ontempory
    ryptology
                     Last Lecture


    History

    Introduction to Polyalphabetic Ciphers
      – Cylinder Ciphers
      – Vigenere Cipher
      – AutoKey Cipher
      – Rotor Cipher
                                              2
                       Review – Vigenere
C
    lassical
        &
    ontempory
    ryptology
                            Cipher
   Use CAP to break this Vigenere cipher:

    mcgaw   pssep   ycuma   kmstm   zfdpf   bqdle   hfltf   fgxsg   guvty
    msrfr   asdrr   lspia   hbgua   mcudc   owfeq   lcwhy   mzrne   dsbsy
    grkey   omfok   iiwar   bcqcy   gphuq   xrzey   ksdca   ngwok   xrwor
    asldc   thkar   vfbpr   tbdlw   lwvnc   xrvsr   kcqgc   kqrmn   nhlne
    ksvos   kqhsr   aoqtf   hghek   izryc   wpbtf   xquyn   mcxsc   kpxtr
    awviq   tfhcc   ghshc   gcpel   hbiop   gsdrj   roolr   asool   zvlsr
    hfbod   vfbpr   hzrgw   iosep   tbgpc   gqllu   tgwhc   hboyr   xqknm
    ecbat   twoaz   es




                                                                            3
C
    lassical
        &
    ontempory
    ryptology
                Review – Nihilist Cipher

   This is a two step cipher polyalphabetic cipher

      – first, letters are represented by numbers using a
         Polybius Square

      – second, like the Vigenere, the key word (in number
         form) is written above the plaintext (also in number
         form) and the ciphertext is the sum of each
         plaintext character and its keyword character


                                                             4
C
    lassical
        &
    ontempory
    ryptology
                         Review - Example
   Start with a Polybius square (using example as a
    keyword)
        1   2    3   4   5         Select another keyword: NEXT
    1   e   x    a   m   p
                                                        35 11 12 45
    2   l   b    c   d   f
    3   g   h    i   k   n          Plaintext: STOP THAT
    4   o   q    r   s   t                     44 45 41 15 45 32 13 45
    5   u   v    w   y   z
                              35 11 12 45 35 11 12 45
                              44 45 41 15 45 32 13 45
                Ciphertext:   79 56 53 60 80 43 25 90
                                                                      5
C
lassical
    &
ontempory
ryptology
                        Outline
           History

           Polygraphic Ciphers

           Introduction to Transpositions




                                             6
C
lassical
    &
ontempory
ryptology




            History




                      7
C
     lassical
         &
     ontempory
     ryptology
                             World War I

   August 5, 1914 - the first day of WWI

   At dawn, the British cable ship Telconia, located in
    the North Sea drops grappling hooks overboard
    and pulls up Germany’s transatlantic cables. They
    are severed and then dropped back into the sea
     – It is England’s first offensive action of the war

   Why was this action so important in determining
    the outcome of WWI?
                                                           8
C
    lassical
        &
    ontempory
    ryptology
                British Exploitation

    England began to exploit this advantage
     almost immediately
       – On the first day of WWI, England formed a new
          black chamber

    By mid November, this black chamber
     moved to room 40 of the old Admiralty
     building so it became known as room 40

                                                         9
C
    lassical
        &
    ontempory
    ryptology
                          Early Failure
   One of the first messages received by room 40,
    had they been able to solve it, might have
    affected the entire course of world history
     – it was message 51 sent by the German naval high command to the
       commander of the German navy in the Mediterranean on August
       4th at 1:35 am
     – the message read (it was finally decoded after it was to late)
       “Alliance with Turkey concluded August 3. Proceed at once to
       Constantinople.”

   If this message had been decoded in time, what
    would England have known and how might
    they have responded?

                                                                        10
C
     lassical
         &
     ontempory
     ryptology
                                        Result
   England missed its chance to destroy the German
    navy

   Germany was able to firm up its relationship with
    Turkey

   Turkey sealed off Russia from her allies

   Russia eventually capitulated and fell into civil war
         How might the history of the world be different if message 51
         had been decoded on time?
                                                                         11
C
 lassical
     &
 ontempory
 ryptology
                Lesson

 Knowledge   must be:
             Accurate
             Complete
             Timely
                         12
C
    lassical
        &
    ontempory
    ryptology
                        A Lucky Break

   Early in September 1914, only one month after the
    start of the war, the German light cruiser
    Magdeburg was wrecked in the Baltic
     – the body of a drowned German officer was picked up by the
       Russians a few hours later
     – clasped in his arms were the cipher and signal books of the
       German Navy
     – In October, Russia turned them over to the British (unusual)

   PROBLEM: none of the 4 letter code words in the
    book appeared in any German message
     – after 3 weeks, ROOM 40 discovered that the code had been
       superenciphered, that is the code words themselves had been
       ciphered using a keyword substitution

                                                                      13
C
       lassical
           &
       ontempory
       ryptology
                    The Growth of Room 40

   During December 1914, ROOM 40 began
    to have trouble reading German messages
      – After an all-night effort they discovered the new key:
       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
       I L D S A M X Z O   B N C V U G   T W F Y P   R E H

    Notice that vowels represented vowels and consonants consonants so the code
    words were still pronounceable

    The Germans began to change their key every 3 months, but by then ROOM 40
    was so proficient that the new key was found by 2 or 3 am and nearly always by
    9 or 10 am

    Overall, during WWI, it is estimated that ROOM 40 intercepted and solved
    15,000 German secret communications                                        14
C
lassical
    &
ontempory
ryptology




      Polygraphic Ciphers




                            15
C
    lassical
        &
    ontempory
    ryptology
                          Definitions

    Review of cipher types
      – Monoalphabetic: each plaintext character is
         assigned to one ciphertext character
       – Polyalphabetic: each plaintext character is assigned
         to more than one ciphertext character

    A polygraphic cipher works on more than one
     plaintext character at a time
      – Groups of plaintext characters are replaced by
          assigned groups of ciphertext characters


                                                           16
C
    lassical
        &
    ontempory
    ryptology
                 Digraphic Ciphers

    For example, a digraphic cipher looks at pairs
     of characters in the plaintext Note a is
      – “at” may be replaced by “ui” assigned 2 values
      – “ai” may be replaced by “nj”

    This is a strong cipher because there are more
     digraphs than single characters
      – In English there are 26 letters but 625 (25 x 25)
         possible digraphs
       – It makes simple frequency analysis useless

                                                            17
C
lassical
    &
ontempory
ryptology




            Playfair




                       18
C
    lassical
        &
    ontempory
    ryptology
                                    Playfair Cipher

    Playfair is a polygraphic method designed to
     invalidate single frequency analysis
      – the key is a 5 x 5 matrix of letters (j is not used)
         arranged by a keyword
       – For example, if the keyword is harpsicord, the
         matrix key is:

                H   A   R   P   S
                I   C   O   D   B
                                     NOTE:   the second R in harpsicord is
                E   F   G   K   L
                                             not used
                M   N   Q   T   U
                V   W   X   Y   Z

                                                                      19
C
    lassical
        &
    ontempory
    ryptology
                            Playfair Rules
    All text is preprocessed
      – j’s are replaced with i’s
      – a null letter such as q is placed between any identical pairs of letters so
         that “tt” becomes “tqt”
       – if the plaintext has an odd number of letters, the null letter is added on
         to the end

    The ciphertext is produced by looking at each pair of letters in the
     plaintext (m1 and m2)
       – if m1 and m2 are in the same row in the key matrix, then they are
         replaced by the characters to their right
       – if m1 and m2 are in the same column then they are replaced by the
         letters below them
       – if m1 and m2 are in different rows and columns then they are replaced
         by the letters found on the other two corners of a rectangle formed by
         m1 and m2


                                                                               20
C
     lassical
         &
     ontempory
     ryptology
                              Rule One
   Using the keyword array formed from
    “software”
     – the plaintext letter pair: “RE” becomes “EB”
     – Note: the rows circle back on
       themselves so the letter pair
       “LQ” becomes “ML”               S   O   F   T   W
                                       A   R   E   B   C
                                       D   G   H   I   K
                                       L   M   N   P   Q
                                       U   V   X   Y   Z




                                                           21
C
     lassical
         &
     ontempory
     ryptology
                           Rule Two
   Again using the keyword array formed from
    “software”
     – the plaintext letter pair “AL” becomes “DU”
     – since the columns circle back
       on themselves, the letter
       pair “TY” becomes “BT”         S   O   F   T
                                                  T   W
                                      A   R   E   B   C
                                      D   G   H   I   K
                                      L   M   N   P   Q
                                      U   V   X   Y   Z




                                                          22
C
      lassical
          &
      ontempory
      ryptology
                            Rule Three
   Using the keyword array formed from
    “software”
     – the letter pair “OP” forms two corners of an
       imaginary rectangle
     – so it is replaced by the
       characters on the other
                                            O       T
       corners “TM”                     S
                                        A   R
                                                F
                                                E   B
                                                        W
                                                        C
                                        D   G   H   I   K
                                        L   M   N   P   Q
                                        U   V   X   Y   Z




                                                            23
C
      lassical
          &
      ontempory
      ryptology
                              Observations
   Playfair was the first cipher in history to be digraphic - to encipher two
    letters at a time so that the result depends on letter pairs
      – As a result, Playfair obliterates single letter characteristics
   In addition, encipherment by digraphs halves the number of elements
    available for frequency analysis (a 100 letter text has only 50 digraphs)

   The number of possible digraphs is far greater than the number of
    single letters so their linguistic characteristics are spread over many
    more elements

   Little is known about its use but Britain’s War Office apparently used it
    during the Boer War



                                                                              24
C
lassical
    &
ontempory
ryptology
                Playfair in CAP

 CAP       will implement playfair:




                                       25
C
      lassical
          &
      ontempory
      ryptology
                   Identifying Playfair
   There are several characteristics of Playfair
    ciphertext that can be useful in identifying it as a
    Playfair system
     – Since it is a substitution system, the rare consonants j, k,
       q, x, and z will appear in higher frequencies than
       plaintext and digraphs containing these consonants will
       appear more frequently
     – There are an even number of letters in the ciphertext
     – When the ciphertext is broken up into digrams, doubled
       letters such as SS, EE, MM, . . . will not appear.

                                                               26
C
         lassical
             &
         ontempory
         ryptology
                                 CAP Feature
   CAP will help in the process of identifying a Playfair (or other polygraphic)
    system



                     Select
                     PolyID




                                                                            27
C
      lassical
          &
      ontempory
      ryptology
                        Playfair Features 1
   There are several features of Playfair ciphertext that
    may be exploited to aid in breaking the cipher
     – Digraphs will be repeated and their recurrences will generally follow
       the normal frequencies for their plaintext equivalents
     – No single letter in the plaintext can ever be represented by itself, i.e.
       “a” can never be represented by “a”
     – Two reversed digraphs in the plaintext such as ER and RE will
       always be enciphered by two reversed digraphs in the ciphertext
     – Each single letter in the plaintext can be enciphered by one of only 5
       other letters – that immediately below it in the same column, and one
       of the four other letters in the same row.
             As a result, the 3 or 4 letters having the highest frequency in the
              ciphertext will usually be found in the same row as “e”

                                                                                    28
C
     lassical
         &
     ontempory
     ryptology
                 Playfair Features 2

   Other features include:
     – It is twice as probable that the two letters of any
       pair are at the corners of a rectangle, than as in
       the same row or column
     – Any given letter cannot represent a letter that it
       combines with diagonally
     – When a cipher letter has been identified as a
       substitute for a plaintext letter there is a 20%
       chance that it represents the same plaintext
       letter in each other appearance.
                                                       29
                     Reconstructing a
C
     lassical
         &
     ontempory
     ryptology
                       Playfair Key
   There are several features that may prove helpful in
    reconstructing the Playfair square from partial
    knowledge of the substitution patterns:
     – An equivalence such as DE = EF implies the
       arrangement of DEF in the same row or the same column
     – Two equivalences such as BF=ND and BM=NI indicate
       that B and N are in the same row
     – Two equivalences such as BY=RU and BT=NU indicate
       that B and U are in the same column
     – Two equivalences such as UC=PY and UH=YD indicate
       that U and Y are in the same row or column and H and D
       are in the same row or column
                                                        30
                     Breaking Playfair –
C
     lassical
         &
     ontempory
     ryptology
                        Initial Steps
   It is best to start with a single and digraph
    frequency analysis because:
     – High frequency ciphertext letters tend to be in
       the upper rows of the Playfair square
     – Low frequency ciphertext letters tend to be in
       the lower rows of the Playfair square
     – The digraph pattern follows plaintext diagrams
            If TH = HM then HM will be a high frequency
             digraph

                                                           31
C
    lassical
        &
    ontempory
    ryptology
                  Probable Word Method

 Given         the Playfair ciphertext below:
pk km km ew dw qn bs hl uf gq zk zp tl fc ls fq tn ca
zw ae ns fq tn zw ps el kz kc xc rb ke tm wg co ab fk
vn cl uf ui df ch hq kc mp



 Assume that it is known that the plaintext phase
 “a sample of” is in the ciphertext

                                                  32
C
     lassical
         &
     ontempory
     ryptology
                      Attack Process
   The general process of a known plaintext
    attack on Playfair involves the following steps:
                                               failed
          Find a            Construct          Merge
      Pattern Match      Possible Squares     Squares


                      failed    Construct
                               Valid Square
                                    succeed


                                 DONE                   33
C
      lassical
          &
      ontempory
      ryptology
                              Step One
   After a single and digraph frequency analysis of the
    ciphertext, run the known plaintext across the
    ciphertext to find possible alignments
     – A possible alignment is one that does not violate any of
        the known characteristics of a Playfair square

               Known: te st a a
                             te st
                           t es ta
              Ciphertext: ah ty cv vg ui no pq



                                                           34
C
     lassical
         &
     ontempory
     ryptology
                                  Example
    For our example try the following:

as   am   pl     eo   f-
pk   km   km     ew   dw qn bs hl uf gq zk zp tl fc ls fq tn ca
zw   ae   ns     fq   tn zw ps el kz kc xc rb ke tm wg co ab fk
vn   cl   uf     ui   df ch hq kc mp

 Will not work because
  1. km can not map to two different pairs
  2. Neither m or e can map to themselves


                                                            35
C
      lassical
          &
      ontempory
      ryptology
                   Example (continued)
     After two slides, the matchings are:

   as   am   pl   eo   f-
pk km   km   ew   dw   qn bs hl uf gq zk zp tl fc ls fq tn ca
zw ae   ns   fq   tn   zw ps el kz kc xc rb ke tm wg co ab fk
vn cl   uf   ui   df   ch hq kc mp

  Will not work because
   1. km can not map to two different pairs
   2. m cannot map to itself


                                                           36
C
     lassical
         &
     ontempory
     ryptology
                      Example (continued)
   After another 2 characters:

      as         am   pl   eo   f-
pk km km         ew   dw   qn   bs hl uf gq zk zp tl fc ls fq tn ca
zw ae ns         fq   tn   zw   ps el kz kc xc rb ke tm wg co ab fk
vn cl uf         ui   df   ch   hq kc mp

This is a possible match since it does not violate any Playfair rules
RESULT: 4 possible pairings as             –   km
                            am             –   ew
                            pl             –   dw
                            eo             -   qn
                                                                37
                             Step Two – Possible
C
         lassical
             &
         ontempory
         ryptology
                                   Squares
   Each of the possible pairings represents a state
    of the Playfair square
                        1                   2                    3                   4
                     as = KM             am = EW             pl = DW             eo = QN
    as    –   km     A   K   S   M       A   E   M   W       P   D   L   W       E   Q   O   N

    am    –   ew     K
                     S
                                         E
                                         M
                                                             D                   Q
                                                             L                   O
    pl    –   dw     M           A   K   W           A   E   W           P   D   N           E    Q

    eo    -   qn                 M   S               W   M               W   L               N    O




            Ultimately this will not work out, so go back to Step 1

                                                                                                 38
C
     lassical
         &
     ontempory
     ryptology
                           Step One (again)
    Return to step 1 and slide the known text to the
     right by 2 characters:
         as      am   pl   eo   f-
pk km km ew      dw   qn   bs   hl uf gq zk zp tl fc ls fq tn ca
zw ae ns fq      tn   zw   ps   el kz kc xc rb ke tm wg co ab fk
vn cl uf ui      df   ch   hq   kc mp

This is also a possible match
RESULT: 4 possible pairings           as   –   ew
                                      am   –   dw
                                      pl   –   qn
                                      eo   -   bs
                                                              39
C
          lassical
              &
          ontempory
          ryptology
                                  Step Two (again)
   Each of the possible pairings represents a state of the Playfair square
                         1                    2                      3                      4
as    –    ew         as = EW              am = DW               pl = QN                eo = BS
am    –    dw         A   E   S   W        A   D   M   W        P   Q   L   N       E    B   O   S
                      E                    D
pl    –    gn         S                    M
                                                                Q
                                                                L
                                                                                    B
                                                                                    O
eo    -    bs         W           A    E   W           A   D    N           P   Q   S            E   B
                                  W    S               M   W                N   L                S   O

                                      What we can deduce:
A and E must be in the same column or row                  A and W must be in the same column or row
W and S must be in the same column or row                  E and S must be in the same column or row
A and D must be in the same column or row                  W and M must be in the same column or row
D and M must be in the same column or row
P and N must be in the same column or row                  P and Q must be in the same column or row
L and Q must be in the same column or row                  L and N must be in the same column or row
E and B must be in the same column or row                  E and S must be in the same column or row
O and S must be in the same column or row                  O and B must be in the same column or row
                                                                                                     40
C
      lassical
          &
      ontempory
      ryptology
                      Step Three – Reasoning 1
   From the prior slide we know the following:
     – A,B,E,D must be in the same row or column
     – Since the alphabet is entered in order after the key word it is
        likely that the letters A,B,C,D,E are not part of the key word so
        they form the second line of the square
             This implies that the key word is 5 letters long

                                      A & W must
                                      be in the same   W
                  A   B   C   D   E   row or column    A   B   C   D   E




                                                                            41
 C
         lassical
             &
         ontempory
         ryptology
                           Step Three – Reasoning 2

       Continuing to apply the required conditions:

    W                                    W                               S                        W            M   S
                        E & S must                                               D & M must
    A   B   C   D   E                    A       B       C       D       E                        A   B   C    D   E
                        be in the same                                           be in the same
                        row or column                                            row or column


                                                                                                              B & O must
                                  Any guess on the key?                                                       be in the same
                                                                                                              row or column
Since this satisfies                         W       O       R       M       S
                                                                                                  W   O        M   S
                                             A       B       C       D       E
all the other conditions                     F       G       H       I       K
                                                                                                  A   B   C    D   E

as well, it is a good                        L       N       P       Q       T

candidate for the key square:                U       V       X       Y       Z
                                                                                                                       42
C
    lassical
        &
    ontempory
    ryptology
                        Using CAP 1

    CAP provides some
     basic tools for breaking
     playfair
      – Including a known word
          search




                                      43
C
    lassical
        &
    ontempory
    ryptology
                      Using CAP 2

    CAP also provides a
     simple Playfair
     worksheet




                                    44
C
lassical
    &
ontempory
ryptology




            Hill Cipher




                          45
C
    lassical
        &
    ontempory
    ryptology
                     Hill Cipher

    Another polygraphic cipher was
     developed by the mathematician Lester
     Hill in 1929 - called the Hill Cipher

    It takes m successive plaintext letters and
     substitutes for them m ciphertext letters


                                               46
C
     lassical
         &
     ontempory
     ryptology
                          Hill Process

   Each character is assigned a numerical value
     – a = 0, b = 1, . . ., z = 25

   for m = 3 the transformation of p1p2p3 to c1c2c3
    is given by 3 equations:

                       c1 = (k11p1 + k12p2 + k13p3) mod 26

                 KEY   c2 = (k21p1 + k22p2 + k23p3) mod 26

                       c3 = (k31p1 + k32p2 + k33p3) mod 26

                                                             47
C
      lassical
          &
      ontempory
      ryptology
                                      Hill Matrix
   The Hill cipher is really a matrix multiplication
    system
     – The enciphering key is an n x n matrix, M
     – The deciphering key is M-1
   For example, if n = 3 one possible key is:
                      17   17     5                            4    9   15
      M=          (   21
                       2
                           18
                            2
                                 21
                                 19
                                      )           M-1 =   (   15
                                                              24
                                                                   17
                                                                    0
                                                                         6
                                                                        17
                                                                             )
          Encrypt ‘n o w’
                      13 14 22   (17 17 5
                                  21 18 21
                                   2 2 19
                                             13
                                          )( ) = ( ) mod 26
                                             14
                                             22
                                                      23
                                                      20
                                                      4


                                                                                 48
                                                     xue
C
    lassical
        &
    ontempory
    ryptology
                CAP Implementation
    CAP will create a Hill cipher for groups of 2 to 6
     characters         CAP will generate
                       a matrix for you or
                        you can load one
                                               First, enter the
                                             group size – which
                                             is the same as the
                                                 matrix size




                                                                  49
C
    lassical
        &
    ontempory
    ryptology
                           Breaking Hill

    The Hill cipher is highly resistant to a ciphertext only
     attack.
      – In fact, the larger the matrix, the more resistant the cipher
          becomes.

    However, it is easy to break using a known plaintext
     attack.
      – The process is much like the method used to break an affine
          cipher in that the known plaintext/ciphertext group is used to set
          up a system of equations which when solved will reveal the key.



                                                                        50
C
    lassical
        &
    ontempory
    ryptology
                         Theory
   We know the ciphertext matrix was created by
    multiplying the plaintext matrix by the key
    matrix or:
                 C = MK
   So, the key matrix can be recovered if we know
    the inverse of the plaintext matrix:
                                    Process: Find the inverse of
                 K=     M-1C            the known plaintext, multiply
                                        it times a segment of ciphertext,
                                        and check the resulting key
                                                                51
C
       lassical
           &
       ontempory
       ryptology
                                 Example

         Eve intercepted the following ciphertext:


209    37 59       255   110   196   247    90 52     34     1    68
 11   130 43        23    20    26   219   119 93    164    12    63
110   202 124      137   112   158   232    23 127   118   128   123
115    89 62       224   199    10   199   142 104   242   120     4
142    26 230      159   129   164   133   153 31    256   210    62


      She suspects that the ciphertext contains the words:
                 “she can not attack us”

                                                                 52
C
    lassical
        &
    ontempory
    ryptology
                  Plaintext Matrix
   Eve translates the known plaintext into a matrix (using
    ASCII representation for the characters which assigns a
    number between 0 and 255)




                She calculates the inverse:




                                                         53
C
lassical
    &
ontempory
ryptology
                                Search
   Eve proceeds to multiply this inverse matrix times
    matrices formed from the ciphertext.
     – Each result is a possible key which she uses to decipher the
       ciphertext.
     – Most of the time the possible key does not work but the one
       time the possible message matched the ciphertext, Eve
       discovered a working key:




                                                                      54
C
    lassical
        &
    ontempory
    ryptology
                        Using CAP
    Breaking a Hill cipher by hand is very time consuming
     however CAP will automate the process
                           Enter a possible                       Enter your best
                           plaintext segment                      guess for the size




                                               Try the possible
                                               keys until one
                                               works




                                                                                   55
C
lassical
    &
ontempory
ryptology




            Transposition




                            56
C
lassical
    &
ontempory
ryptology
                           Cipher Structure
                                  ...

                  Classical             Stream       Block


    Transposition             Substitution



                 polyalphabetic                             monoalphabetic




      Nihilist     Vigenere       Hill       MultiLiteral      Keyword       Affine   Shift




                                                                                          57
C
    lassical
        &
    ontempory
    ryptology
                           Transpositions
   Transposition ciphers are like jigsaw puzzles in
    that all the pieces are present but are merely
    disarranged

   There are two types of transpositions
      – monographic methods - deal with individual letters
      – polygraphic methods - deal with units greater than single letters (words,
         phases, etc)


   Most transpositions involve a geometric figure
    (square, rectangle, . . .)
      – the letters are inscribed in the figure is some agreed upon direction
      – the letters are then transcribed or rewritten according to another
         direction to form the ciphertext
                                                                                58
C
    lassical
        &
    ontempory
    ryptology
                    Transposition Key

   The specific key controls
      – the geometric figure and its dimension
      – the variation in the direction of inscription and transcription

   If the transposition cipher involves only a single
    process of inscription followed by a single process
    of transcription it is called a monophase
    transposition, if additional methods of inscription
    and transcription intervene between the original
    inscription and the final transcription it is called
    a polyphase transposition
                                                                          59
C
     lassical
         &
     ontempory
     ryptology
                                   Rail Fence
 Process:   rather than substitute
  letters, rearrange letters in the text

 RAIL-FENCE cipher
   – PLAINTEXT: this is a test
   – CIPHERTEXT: tiehsstsiat
   – METHOD
                 Inscribe by a     t               i               e
                 zigzag pattern
                                       h       s       s       t       s
                 extract by rows           i               a               t
                                                                               60
C
   lassical
       &
   ontempory
   ryptology
                     Other Figures

 Use   a triangle of a fixed size:
               PlainText: You must do that now

                              Y
   Inscribe by rows         o u m
                          u s t d o
                        t h a t n o w

Extract by columns     tuhosayuttmdnoow

                                                 61
C
lassical
    &
ontempory
ryptology




       Permutation Cipher




                            62
C
      lassical
          &
      ontempory
      ryptology
                  Permutation Method
   Break the plaintext up into groups of a fixed size, d
     – define a permutation of the integers 1 to d called f
     – within each block, permute the letters according to f
     – the key is (d,f)

   For example, let d = 5 and let f be given by:
         1        3
                           g e t t h        e b a l l
         2        4
         3        1        t h g e t        al e b l
         4        5
         5        2                                      63
C
 lassical
     &
 ontempory
 ryptology
             CAP Implementation

 Select     Permutation under the cipher
    menu




                                        64
C
     lassical
         &
     ontempory
     ryptology
                 Breaking a Permutation
   A known word attack can match the word with
    the ciphertext to discover the permutation




                                                  65
C
lassical
    &
ontempory
ryptology




    Column Transposition




                           66
C
    lassical
        &
    ontempory
    ryptology
                     Column Transposition
   Write the plaintext into a matrix by rows, then
    generate the ciphertext by selecting the columns in
    a given order

   For example, given the plaintext “encryption
    algorithms” and a 5x4 matrix         KEY

     1 2 3 4
     E   N
         N   C   R    Select the columns in the order 4 - 2 - 1 - 3
     Y   P
         P   T   I
     O   N
         N   A   L
                      R   I   L   I   S   N   P   N   O   H   E   Y   O   G   T   C   T   A   R    M
     G   O
         O   R   I
     T   H
         H   M   S


                                                                                              67
C
 lassical
     &
 ontempory
 ryptology
                        Column Key

 The key for a column transposition
 is the number of columns and the
 order in which they are selected
    Both can be specified by a keyword:

             the length of the keyword is the number of columns

             the order of the letters in the keyword determines
             the order in which the columns are selected

                                                                  68
C
     lassical
         &
     ontempory
     ryptology
                   Example Key

   For example, the keyword “general” defines a
    column transposition with 7 columns

   To define the order of columns assign each
    letter a number based on its order in the
    alphabet
                 g e n e r a l
                 4 2 6 3 7 1 5
                                                 69
C
      lassical
          &
      ontempory
      ryptology
                  Transpositions in CAP

   When you select
    Column Transposition,
    CAP presents a key
    window:




                                      70
                                Breaking
C
      lassical
          &
      ontempory
      ryptology
                              Transpositions
   We will look at the process of breaking a keyed
    columnar transposition with completely filled
    rectangles

   Given the following cipher, what is the first thing
    you must determine?
    NETEF   LTDSR   TSSTF   MDCET DRHXS WHOHO EEADU OUUFI RRRRS
    NEROT   CFIEM   EDSHA   RTCPJ AOEGE WNLHO EPMWA WERUV AAINA
    TSDDS   OEOAC   EHNTL   HFLAU RAEEN OTOTS SOSYS TNNCG EMETT
    YDYRR   NEOOE   RESTH   INR


                                                                  71
C
 lassical
     &
 ontempory
 ryptology
                       Tasks

 There   are three tasks
    involved in breaking a
    column transposition cipher:
    – Find possible rectangle sizes
    – Select the correct rectangle
    – Find the column order

                                      72
C
  lassical
      &
  ontempory
  ryptology
               Possible Rectangles

 Thefirst step in analyzing a column
 transposition is determining the
 number of columns
    – in a completely filled transposition, the number of
      characters is the product of the number of rows
      and the number of columns
    – so, factor the number of characters to determine
      possible row and column sizes


                                                            73
C
      lassical
          &
      ontempory
      ryptology
                           Example
   First, factor the message length of the example
    ciphertext

   our message has 153 letters and 153 has 3, 9, 17, and
    51 as factors

   possible rectangle sizes (columns by row): 3 x 51, 51 x
    3, 9 x 17, or 17 x 9

   9 x 17 and 17 x 9 are the most probable because the
    other two have poor distributions of rows vs columns
                                                      74
C
    lassical
        &
    ontempory
    ryptology
                 Which Rectangle?

   Since the factors only supply possible
    column sizes - test each possibility by
    doing a vowel count
     – any line of plaintext should contain about 40%
       vowels
     – So, count the vowels in each row of each possible
       rectangle
     – the one with the best match to 40% is the best
       choice for the actual rectangle

                                                           75
C
       lassical
           &
       ontempory
       ryptology
                                       Rectangle 1
   The 9 x 17 rectangle - 3.6 vowels per row expected (9 x .4)
    1 2 3 4        5   6   7   8   9     vowels
    difference
    N C U F        G   A   N   S   E      2       1.6
    E E O I        E   A   T   S   Y      7       3.4
    T T U E        W   I   L   O   R      4        .4
    E D U M        N   N   H   S   R      2       1.6
    F R F E        L   A   F   Y   N      3        .6
    L H I D        H   T   L   S   E      2       1.6
    T X R S        O   S   A   T   O      3        .6
    D S R H        E   D   U   N   O      3        .6   Total Difference
    S W R A        P   D   R   N   E      2       1.6         20.6
    R H R R        M   S   A   C   R      1       2.6
    T O S T        W   O   E   G   E      4        .4
    S H N C        A   E   E   E   S      4        .4
    S O E P        W   O   N   M   T      3        .6
    T E R J        E   A   O   E   H      5       1.4
    F E O A        R   C   T   T   I      4        .4
    M A T O        U   E   O   T   N      5       1.4
                                                                  76
    D D C E        V   H   T   Y   R      2       1.6
C
        lassical
            &
        ontempory
        ryptology
                                    Rectangle 2
   The second possible rectangle is 17 x 9 (expected per
    row vowel count = 6.8)
1   2   3   4   5   6   7   8   9 10 11 12 13 14 15 16 17   Vowels   Difference
N   R   E   O   U   N   M   P   L E T C A O N Y E             8         1.2
E   T   T   H   U   E   E   J   H R S E U T N D R             6          .8
T   S   D   O   F   R   D   A   O U D H R S C Y E             6          .8
E   S   R   E   I   O   S   O   E V D N A S G R S             7          .2
F   T   H   E   R   T   H   E   P A S T E O E R T             6          .8
L   F   X   A   R   C   A   G   M A O L E S M N H             5         1.8
T   M   S   D   R   F   R   E   W I E H N Y E E I             7          .2
D   D   W   U   R   I   T   W   A N O F O S T O N             6          .8
S   C   H   O   S   E   C   N   W A A L T T T O R             5         1.8
                                                                        8.4



            Which of the two is the most likely rectangle?
                                                                         77
C
     lassical
         &
     ontempory
     ryptology
                            Letter Affinity
   Once the rectangle size is determined, the column
    order must be discovered
     – Advantage is taken of all the characteristics of the plaintext
       language

   First, in all languages there are certain letters
    usually of medium or low frequency which
    combine with other letters to form diagrams of
    high frequency
     – H (medium frequency) combines with T to form TH (highest
       frequency)
     – H combines with C (medium frequency) to form CH
     – V (low frequency) combines with E to form VE (medium frequency
       in military text)

                                                                        78
C
    lassical
        &
    ontempory
    ryptology
                        Rules

    When there is an H, attempts should be
     made to combine it with a T or a C

    A V should be combined first with an E

    A K should be combined first with a C


                                              79
C
     lassical
         &
     ontempory
     ryptology
                             Pilot Letters
   Second, there is usually in every language at least
    one letter which can be followed by only certain
    other letters forming an obligatory sequence or
    invariable digraph
     – Q is always followed by U
     – J can only be followed by a vowel
     – X can be preceded only by a vowel and except at the end of a
        word can only be succeeded by a vowel or C, H, P, T

   Letters such as these with limited affinity are
    called pilot letters

                                                                      80
C
     lassical
         &
     ontempory
     ryptology
                                Anagramming
   Breaking a transposition cipher is a process of anagramming by
    selecting a pilot letter and trying to form digrams with the other
    letters in its row
             for example, select the J in column 8 and match it with . . .

     1   2     3   4   5    6   7    8   9 10 11 12 13 14 15 16 17
     N   R     E   O   U    N   M    P   L E T C A O N Y E
     E   T     T   H   U    E   E    J   H R S E U T N D R
     T   S     D   O   F    R   D    A   O U D H R S C Y E
     E   S     R   E   I    O   S    O   E V D N A S G R S
     F   T     H   E   R    T   H    E   P A S T E O E R T
     L   F     X   A   R    C   A    G   M A O L E S M N H
     T   M     S   D   R    F   R    E   W I E H N Y E E I
     D   D     W   U   R    I   T    W   A N O F O S T O N
     S   C     H   O   S    E   C    N   W A A L T T T O R
                                                                             81
C
  lassical
      &
  ontempory
  ryptology
              Centiban Weights

 TheUS government studied a set of
 5,000 digrams and produced a table
 of what are called centiban weights

 Thistable contains the logarithm of
 twice the frequency of each digram

                                        82
C
             lassical
                 &
             ontempory
             ryptology
                                                Centiban Table
                                                     Second Letter
         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
    A   33   45   61   73   13   38   45   25   64   13   25   76   61   89   25   58   00   82   80   83   59   48   33   00   58   00
    B   38   00   00   00   66   00   00   00   25   13   00   45   13   00   38   00   00   25   13   13   25   00   00   00   48   00
F   C   67   00   33   13   76   13   00   61   48   00   38   42   13   13   80   00   00   38   13   61   38   00   13   00   13   00
    D   76   38   38   51   77   51   25   25   73   13   00   33   42   38   63   42   25   58   59   62   42   33   38   00   13   00
i   E   78   38   76   88   81   66   38   48   73   13   00   74   61   99   58   67   58   94   86   79   33   67   48   48   38   13
    F   42   00   25   13   55   56   13   00   80   00   00   25   13   00   80   13   00   53   33   56   33   00   13   00   13   00
r   G   48   00   25   13   61   25   13   67   42   13   00   25   13   33   45   25   00   42   33   38   25   00   13   00   00   00
    H   67   13   33   25   67   42   00   00   77   00   00   13   25   33   67   13   13   64   38   74   51   00   13   00   13   00
s   I   51   25   69   45   59   55   67   00   00   00   25   70   53   92   80   48   00   73   78   73   00   72   00   62   00   25
    J   18   00   00   00   25   00   00   00   00   00   00   00   00   00   25   00   00   00   00   00   25   00   00   00   00   00
t   K   13   00   13   00   45   00   00   00   25   00   00   13   00   13   00   00   00   00   13   00   00   00   00   00   00   00
    L   74   33   33   53   79   33   13   13   67   00   00   73   25   13   59   33   00   25   45   51   25   25   25   00   55   00
    M   78   45   33   13   72   13   00   13   53   00   00   00   59   00   55   51   00   25   38   25   25   00   00   00   25   00
L   N   72   25   67   85   87   53   73   38   75   13   25   42   42   51   66   33   13   38   71   93   48   33   33   00   42   00
    O   48   38   51   58   33   72   25   33   42   13   25   67   72   92   45   72   00   89   61   67   79   48   51   13   25   00
e   P   61   13   13   13   70   25   00   33   45   00   00   59   38   13   64   56   00   66   45   51   33   13   13   00   13   00
    Q   00   00   00   00   00   00   00   00   00   00   00   00   13   00   00   00   00   13   00   00   62   00   00   00   00   00
t   R   80   25   53   64   96   45   48   33   75   13   13   42   53   48   74   59   00   56   75   81   42   42   38   00   53   00
    S   71   33   59   42   84   58   25   72   77   00   13   25   33   38   62   55   00   42   67   88   56   13   38   00   13   00
t   T   74   33   45   45   91   48   13   92   82   00   00   42   45   48   84   25   13   64   67   67   42   00   78   00   80   13
e   U   42   33   33   33   56   13   51   00   42   00   00   45   42   68   13   25   00   75   58   58   00   13   00   00   00   00
    V   45   00   00   00   87   00   00   00   58   00   00   00   00   00   13   00   00   00   00   13   00   00   00   00   00   00
r   W   58   00   00   00   69   00   00   38   59   00   00   13   00   25   67   00   00   13   13   00   00   00   00   00   13   00
    X   25   00   25   13   13   13   00   13   25   00   00   00   00   13   13   25   00   13   13   48   00   00   00   00   00   00
    Y   45   25   38   38   53   56   13   13   33   00   00   25   25   45   55   33   00   38   56   62   13   00   13   00   00   00
    Z   13   00   00   00   25   00   00   00   13   00   00   00   00   00   00   00   00   00   00   00   00   00   00   00   00   00


                                                                                                                                83
C
     lassical
         &
     ontempory
     ryptology
                      Possible Pairings
   Try both JU pairings in the example and rank each
    digram by the centiban numbers
     8   5 rank   8    13   rank
     P   U 33     P     A    61
     J   U 25     J     U    25
     A   F 38     A     R    82
     O   I 42     O     A    48
     E   R 94     E     E    81 Result: pair columns 8 and 13
     G   R 42     G     E    61
     E   R 94     E     N    99
     W   N 25     W     O    67
     N   S 71     N     T    93
           464              617
                                                        84
C
      lassical
          &
      ontempory
      ryptology
                       Form Trigrams
   The digram JU should be followed by a consonant,
    preferably N or S - columns 15 and 11 are
    candidates
                  8 13 15 rank   8 13 11 rank
                  P A N     89   P A T     83
                  J U N     68   J U S     58
                  A R C     53   A R D     64
                  O A G     45   O A D     73
                  E E E     81   E E S     86
                  G E M     61   G E O     58
                  E N E     87   E N E     87
                  W 0 T     67   W O O     45
                  N T T     67   N T A     74
                           618            628
                                                  85
C
     lassical
         &
     ontempory
     ryptology
                             Look for Words
 Continue this process looking for new digrams and for possible
  words
 For example, are there any possible words in this text?
      8 13 11        1   2   3   4   5   6   7   9 10 12 14 15 16 17
      P A T          N   R   E   O   U   N   M   L E C O N Y E
      J U S          E   T   T   H   U   E   E   H R E T N D R
      A R D          T   S   D   O   F   R   D   O U H S C Y E
      O A D          E   S   R   E   I   O   S   E V N S G R S
      E E S          F   T   H   E   R   T   H   P A T O E R T
      G E O          L   F   X   A   R   C   A   M A L S M N H
      E N E          T   M   S   D   R   F   R   W I H Y E E I
      W O O          D   D   W   U   R   I   T   A N F S T O N
      N T A          S   C   H   O   S   E   C   W A L T T O R

                 Try centiban weights or look for other words          86
C
lassical
    &
ontempory
ryptology
                                Solution

    3   6 17   7 16   8 13 11   2   14    9 10   1 12   4   5 15
    E   N E    M Y    P A T     R   O    L E     N C    O   U N
    T   E R    E D    J U S     T   T    H R     E E    H   U N
    D   R E    D Y    A R D     S   S    O U     T H    O   F C
    R   O S    S R    O A D     S   S    E V     E N    E   I G
    H   T T    H R    E E S     T   O    P A     F T    E   R E
    X   C H    A N    G E O     F   S    M A     L L    A   R M
    S   F I    R E    E N E     M   Y    W I     T H    D   R E
    W   I N    T O    W O O     D   S    A N     D F    U   R T
    H   E R    C O    N T A     C   T    W A     S L    O   S T




                                                                   87
C
      lassical
          &
      ontempory
      ryptology
                  Column Size in CAP
   CAP will determine both possible column sizes and run a
    vowel analysis of each column:




                                                              88
C
     lassical
         &
     ontempory
     ryptology
                 Anagramming in CAP
   CAP provides a tool to aid in the anagramming
    process




                                                    89
C
lassical
    &
ontempory
ryptology
                     Summary
   History

   Polygraphic Ciphers
     – Playfair
     – Hill

   Introduction to Transpositions
     – Permutation
     – Column Transposition

                                     90

								
To top