Ch3 Cryptanalysis for Classical Crypto

Embed Size (px)

Citation preview

  • 8/16/2019 Ch3 Cryptanalysis for Classical Crypto

    1/30

    CryptanalysisFor Classical cryptography 

  • 8/16/2019 Ch3 Cryptanalysis for Classical Crypto

    2/30

    2

  • 8/16/2019 Ch3 Cryptanalysis for Classical Crypto

    3/30

    3

  • 8/16/2019 Ch3 Cryptanalysis for Classical Crypto

    4/30

    4

  • 8/16/2019 Ch3 Cryptanalysis for Classical Crypto

    5/30

    5

  • 8/16/2019 Ch3 Cryptanalysis for Classical Crypto

    6/30

    6

  • 8/16/2019 Ch3 Cryptanalysis for Classical Crypto

    7/30

    7

  • 8/16/2019 Ch3 Cryptanalysis for Classical Crypto

    8/30

    8

  • 8/16/2019 Ch3 Cryptanalysis for Classical Crypto

    9/30

    Cryptanalysis: Monoalphabetic/polyalphabetic

  • 8/16/2019 Ch3 Cryptanalysis for Classical Crypto

    10/30

    Problem of Substitutions

    10

    Each plaintext letter is mapped to exactly one ciphertextletter

    => letter frequency is always applicable

  • 8/16/2019 Ch3 Cryptanalysis for Classical Crypto

    11/30

    Substitutions are Monoalphabetic

    11

    Shift (Ceaser) Cipher can be viewed as: For key 17 = R:

    R R R R R R

    A T T A C K

    R K K R T B

  • 8/16/2019 Ch3 Cryptanalysis for Classical Crypto

    12/30

    Substitutions are Monoalphabetic

    12

    Shift (Ceaser) Cipher can be viewed as: For key 17 = R:

    R R R R R R

    A T T A C K

    R K K R T B

  • 8/16/2019 Ch3 Cryptanalysis for Classical Crypto

    13/30

    Polyalphabetic

    13

    Chose a key with multiple letters, i.e. multiple-keys foreach letter substitution:

    S E C U R E

    A T T A C K

    S X V C T O

    Note: each occurrence of A and T is encrypted differently!

  • 8/16/2019 Ch3 Cryptanalysis for Classical Crypto

    14/30

    Polyalphabetic

    14

    To encrypt, use the Vigenère table:

  • 8/16/2019 Ch3 Cryptanalysis for Classical Crypto

    15/30

    Polyalphabetic

    15

    Example of T encryption with key E:

  • 8/16/2019 Ch3 Cryptanalysis for Classical Crypto

    16/30

    Polyalphabetic

    16

    Our example works fine:

    S E C U R E

    A T T A C K

    S X V C T O

    In practice, key is shorter than message:

    key: Deceptive plaintext: “We are discovered save yourself”.

  • 8/16/2019 Ch3 Cryptanalysis for Classical Crypto

    17/30

    Vigenère Cipher

    17

    This is why we repeat the key:

    key: deceptivedeceptivedeceptive

    plaintext: wearediscoveredsaveyourself 

    ciphertext: zicvtwqngrzgvtwavzhcqyglmgj

  • 8/16/2019 Ch3 Cryptanalysis for Classical Crypto

    18/30

    Vigenère Cipher

    18

    Plaintext letters: P = p0, p1, p2, ..., pn-1

    Key letters:

    K = k0, k1, k2, ..., km-1 where usually m

  • 8/16/2019 Ch3 Cryptanalysis for Classical Crypto

    19/30

    Vigenère Cipher

    19

    General rule: Ci = (pi + ki mod m) mod 26

    Decryption:

    pi = (Ci - ki mod m) mod 26

  • 8/16/2019 Ch3 Cryptanalysis for Classical Crypto

    20/30

    Vigenère Weakness

    20

    Similar plain/cipher letter sequences are encrypted in thesame cipher sequences:

    Key: deceptivedeceptivedeceptive

    Plaintext: wearediscoveredsaveyourself 

    Ciphertext: zicvtwqngrzgvtwavzhcqyglmgj

  • 8/16/2019 Ch3 Cryptanalysis for Classical Crypto

    21/30

    Vigenère Weakness

    21

    Similar plain/cipher letter sequences are encrypted in thesame cipher sequences:

    Key: deceptivedeceptivedeceptive

    Plaintext: wearediscoveredsaveyourself 

    Ciphertext: zicvtwqngrzgvtwavzhcqyglmgj

  • 8/16/2019 Ch3 Cryptanalysis for Classical Crypto

    22/30

    Vigenère Weakness

    22

    Similar plain/cipher letter sequences are encrypted in thesame cipher sequences:

    Key: deceptivedeceptivedeceptive

    Plaintext: wearediscoveredsaveyourself 

    Ciphertext: zicvtwqngrzgvtwavzhcqyglmgj

  • 8/16/2019 Ch3 Cryptanalysis for Classical Crypto

    23/30

    Vigenère Weakness

    23

    Similar plain/cipher letter sequences are encrypted in thesame cipher sequences:

    Key: deceptivedeceptivedeceptive

    Plaintext: wearediscoveredsaveyourself Ciphertext: zicvtwqngrzgvtwavzhcqyglmgj

    If two identical sequences of plaintext letters occur at adistance that is an integer multiple of the keyword length,they will generate identical ciphertext sequences

  • 8/16/2019 Ch3 Cryptanalysis for Classical Crypto

    24/30

    Vigenère Cryptanalysis

    24

    In our example, key length is either 3 or 9:

    Key: deceptivedeceptivedeceptive

    Plaintext: wearediscoveredsaveyourself 

    Ciphertext: zicvtwqngrzgvtwavzhcqyglmgj

    9

  • 8/16/2019 Ch3 Cryptanalysis for Classical Crypto

    25/30

    Vigenère Cryptanalysis

    25

    Note: the appearance of VTW twice could be by chance!

    However, if the message is long enough, there will be a

    number of such repeated ciphertext sequences.

    By looking for common factors in the displacements of

    the various sequences, the analyst should be able to make

    a good guess of the keyword length

  • 8/16/2019 Ch3 Cryptanalysis for Classical Crypto

    26/30

    Vigenère Cryptanalysis

    26

    Example:KCCPKBGUFDPHQTYAVINRRTMVGRKDNBVFDETDGIL

    TXRGUDDKOTFMBPVGEGLTGCKQRACQCWDNAWC

    RXIZAKFTLEWRPTYCQKYVXCHKFTPONCQQRHJVAJ

    UWETMCMSPKQDYHJVDAHCTRLSVSKCGCZQQDZXGSFRLSWCWSJTBHAFSIASPRJAHKJRJUMVGKMITZHFPDIS

    PZLVLGWTFPLKKEBDPGCEBSHCTJRWXBAFSPEZQNR

    WXCVYCGAONWDDKACKAWBBIKFTIOVKCGGHJVL

    NHIFFSQESVYCLACNVRWBBIREPBBVFEXOSCDYGZWPFDTKFQIYCWHJVLNHIQIBTKHJVNPIST

  • 8/16/2019 Ch3 Cryptanalysis for Classical Crypto

    27/30

    Vigenère Cryptanalysis

    27

    Example:KCCPKBGUFDPHQTYAVINRRTMVGRKDNBVFDETDGIL

    TXRGUDDKOTFMBPVGEGLTGCKQRACQCWDNAWC

    RXIZAKFTLEWRPTYCQKYVXCHKFTPONCQQRHJVAJ

    UWETMCMSPKQDYHJVDAHCTRLSVSKCGCZQQDZXGSFRLSWCWSJTBHAFSIASPRJAHKJRJUMVGKMITZHFPDIS

    PZLVLGWTFPLKKEBDPGCEBSHCTJRWXBAFSPEZQNR

    WXCVYCGAONWDDKACKAWBBIKFTIOVKCGGHJVL

    NHIFFSQESVYCLACNVRWBBIREPBBVFEXOSCDYGZWPFDTKFQIYCWHJVLNHIQIBTKHJVNPIST

  • 8/16/2019 Ch3 Cryptanalysis for Classical Crypto

    28/30

    Vigenère Cryptanalysis

    28

    Example:KCCPKBGUFDPHQTYAVINRRTMVGRKDNBVFDETDGIL

    TXRGUDDKOTFMBPVGEGLTGCKQRACQCWDNAWC

    RXIZAKFTLEWRPTYCQKYVXCHKFTPONCQQRHJVAJ

    UWETMCMSPKQDYHJVDAHCTRLSVSKCGCZQQDZXGSFRLSWCWSJTBHAFSIASPRJAHKJRJUMVGKMITZHFPDIS

    PZLVLGWTFPLKKEBDPGCEBSHCTJRWXBAFSPEZQNR

    WXCVYCGAONWDDKACKAWBBIKFTIOVKCGGHJVL

    NHIFFSQESVYCLACNVRWBBIREPBBVFEXOSCDYGZWPFDTKFQIYCWHJVLNHIQIBTKHJVNPIST

    Positions: 108, 126, 264, 318, and 330

    Key length m is most likely = gcd(δ1, δ2, …)

  • 8/16/2019 Ch3 Cryptanalysis for Classical Crypto

    29/30

    Remedy 

    29

    The absolute remedy of this weakness is to use a key as

    long as the message

    It produces random output that bears no statistical

    relationship to the plaintext

    It is simply unbreakable!

  • 8/16/2019 Ch3 Cryptanalysis for Classical Crypto

    30/30

    Example

    30

    Example:

    Ciphertext:

    ANKYODKYUREPFJBYOJDSPLREYIUNOFDOIUERFPLUYTS

    Key:

    pxlmvmsydofuyrvzwc tnlebnecvgdupahfzzlmnyih

    Plaintext:

    mr mustard with the candlestick in the hall