Вы находитесь на странице: 1из 30

Cryptanalysis

For Classical cryptography

Cryptanalysis: Monoalphabetic/
polyalphabetic

Problem of Substitutions

Each plaintext letter is mapped to exactly one ciphertext


letter
=> letter frequency is always applicable

10

Substitutions are Monoalphabetic

Shift (Ceaser) Cipher can be viewed as:


For key 17 = R:
RRRRRR
ATTA C K
R K K RT B

11

Substitutions are Monoalphabetic

Shift (Ceaser) Cipher can be viewed as:


For key 17 = R:
RRRRRR
ATTA C K
R K K RT B

12

Polyalphabetic

Chose a key with multiple letters, i.e. multiple-keys for


each letter substitution:
SECURE
ATTA C K
S XV CT O

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

13

Polyalphabetic

To encrypt, use the Vigenre table:

14

Polyalphabetic

Example of T encryption with key E:

15

Polyalphabetic

Our example works fine:


SECURE
ATTA C K
S XV CT O

In practice, key is shorter than message:

16

key: Deceptive
plaintext: We are discovered save yourself.

Vigenre Cipher

This is why we repeat the key:

17

key: deceptivedeceptivedeceptive
plaintext: wearediscoveredsaveyourself
ciphertext: zicvtwqngrzgvtwavzhcqyglmgj

Vigenre Cipher

Plaintext letters:

Key letters:

P = p0, p1, p2, ..., pn-1


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

Ciphertext letters:

C = C0, C1, C2, ..., Cn-1= ek(P)

= (p0 + k0) mod 26 + ... +


(pm-1 + km-1) mod 26 + (pm + k0) mod 26 + ...

18

Vigenre Cipher

General rule:

Ci = (pi + ki mod m) mod 26

Decryption:

19

pi = (Ci - ki mod m) mod 26

Vigenre Weakness

Similar plain/cipher letter sequences are encrypted in the


same cipher sequences:
Key:
deceptivedeceptivedeceptive
Plaintext:
wearediscoveredsaveyourself
Ciphertext: zicvtwqngrzgvtwavzhcqyglmgj

20

Vigenre Weakness

Similar plain/cipher letter sequences are encrypted in the


same cipher sequences:
Key:
deceptivedeceptivedeceptive
Plaintext:
wearediscoveredsaveyourself
Ciphertext: zicvtwqngrzgvtwavzhcqyglmgj

21

Vigenre Weakness

Similar plain/cipher letter sequences are encrypted in the


same cipher sequences:
Key:
deceptivedeceptivedeceptive
Plaintext:
wearediscoveredsaveyourself
Ciphertext: zicvtwqngrzgvtwavzhcqyglmgj

22

Vigenre Weakness

Similar plain/cipher letter sequences are encrypted in the


same cipher sequences:
Key:
deceptivedeceptivedeceptive
Plaintext:
wearediscoveredsaveyourself
Ciphertext: zicvtwqngrzgvtwavzhcqyglmgj

If two identical sequences of plaintext letters occur at a


distance that is an integer multiple of the keyword length,
they will generate identical ciphertext sequences
23

Vigenre Cryptanalysis

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

Key:
deceptivedeceptivedeceptive
Plaintext:
wearediscoveredsaveyourself
Ciphertext: zicvtwqngrzgvtwavzhcqyglmgj
9

24

Vigenre Cryptanalysis

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

25

Vigenre Cryptanalysis
Example:
KCCPKBGUFDPHQTYAVINRRTMVGRKDNBVFDETDGIL
TXRGUDDKOTFMBPVGEGLTGCKQRACQCWDNAWC
RXIZAKFTLEWRPTYCQKYVXCHKFTPONCQQRHJVAJ
UWETMCMSPKQDYHJVDAHCTRLSVSKCGCZQQDZXG
SFRLSWCWSJTBHAFSIASPRJAHKJRJUMVGKMITZHFPDIS
PZLVLGWTFPLKKEBDPGCEBSHCTJRWXBAFSPEZQNR
WXCVYCGAONWDDKACKAWBBIKFTIOVKCGGHJVL
NHIFFSQESVYCLACNVRWBBIREPBBVFEXOSCDYGZWP
FDTKFQIYCWHJVLNHIQIBTKHJVNPIST

26

Vigenre Cryptanalysis
Example:
KCCPKBGUFDPHQTYAVINRRTMVGRKDNBVFDETDGIL
TXRGUDDKOTFMBPVGEGLTGCKQRACQCWDNAWC
RXIZAKFTLEWRPTYCQKYVXCHKFTPONCQQRHJVAJ
UWETMCMSPKQDYHJVDAHCTRLSVSKCGCZQQDZXG
SFRLSWCWSJTBHAFSIASPRJAHKJRJUMVGKMITZHFPDIS
PZLVLGWTFPLKKEBDPGCEBSHCTJRWXBAFSPEZQNR
WXCVYCGAONWDDKACKAWBBIKFTIOVKCGGHJVL
NHIFFSQESVYCLACNVRWBBIREPBBVFEXOSCDYGZWP
FDTKFQIYCWHJVLNHIQIBTKHJVNPIST

27

Vigenre Cryptanalysis
Example:
KCCPKBGUFDPHQTYAVINRRTMVGRKDNBVFDETDGIL
TXRGUDDKOTFMBPVGEGLTGCKQRACQCWDNAWC
RXIZAKFTLEWRPTYCQKYVXCHKFTPONCQQRHJVAJ
UWETMCMSPKQDYHJVDAHCTRLSVSKCGCZQQDZXG
SFRLSWCWSJTBHAFSIASPRJAHKJRJUMVGKMITZHFPDIS
PZLVLGWTFPLKKEBDPGCEBSHCTJRWXBAFSPEZQNR
WXCVYCGAONWDDKACKAWBBIKFTIOVKCGGHJVL
NHIFFSQESVYCLACNVRWBBIREPBBVFEXOSCDYGZWP
FDTKFQIYCWHJVLNHIQIBTKHJVNPIST
Positions: 108, 126, 264, 318, and 330
Key length m is most likely = gcd(1, 2, )

28

Remedy

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!

29

Example

Example:
Ciphertext:

Key:

ANKYODKYUREPFJBYOJDSPLREYIUNOFDOIUERFPLUYTS
pxlmvmsydofuyrvzwc tnlebnecvgdupahfzzlmnyih

Plaintext:

30

mr mustard with the candlestick in the hall

Вам также может понравиться