22
W A U G Y J Y O I H K Y G L I U G L U K U Y G K U I F K U L Y U T D K R T D Y U K L O I Y U T Y A U G Y J Y O I H I H K Y G L I U G L U K U Y G K U I F K U L Y U T D K A U G W E R G H F D S O J H U I C R Y P T A N A L Y S I S I G U K Y I T U D R D T F H B J N K L I H U Y G U Q A Z X D E D F B A S I C X C I P H E R S J K N L I O U T Y F K U I F A N D Y A T B I T U M O R E G H F D S T E R D T Y U B J N L Y U T D K R T D Y U K L M I J U H Y T Y K U I H L M P U Y T R E R S D T F Y V G U B N I S E R D T M P U G S L B Y X A G I T

Cryptanalysis - basic ciphers and a bit more

Embed Size (px)

Citation preview

Page 1: Cryptanalysis - basic ciphers and a bit more

W A U G Y J Y O I H K Y G L I U G L U K U Y G K U I F K U L Y U T D K R T D Y U K L O I Y U T Y A U G Y J Y O I H I H K Y G L I U G L U K U Y G K U I F K U L Y U T D K A U G W E R G H F D S O J H U I C R Y P T A N A L Y S I S I G U K Y I T U D R D T F H B J N K L I H U Y G U Q A Z X D E D F B A S I C X C I P H E R S J K N L I O U T Y F K U I F A N D Y A T B I T U M O R E G H F D S T E R D T Y U B J N L Y U T D K R T D Y U K L M I J U H Y T Y K U I H L M P U Y T R E R S D T F Y V G U B N I S E R D T M P U G S L B Y X A G I T

Page 2: Cryptanalysis - basic ciphers and a bit more

Dictionary

• Cryptography -- the practice and study of techniques for secure communication in the presence of third parties

• Cryptanalysis -- the study of analyzing information systems in order to study the hidden aspects of the systems

• Cipher -- an algorithm for performing encryption or decryption

Page 3: Cryptanalysis - basic ciphers and a bit more

The Good, the Bad and the Ugly

Encoding

Encryption Hashing

Page 4: Cryptanalysis - basic ciphers and a bit more

Encoding (the Good)

• A simple (or not) abstraction level

• Commonly used in data storage, data transmission, etc.

• Examples: ASCII, UTF-8/16/32, Base64, etc.

• More examples: Braille alphabet, Morse code, Human DNA, etc.

Page 5: Cryptanalysis - basic ciphers and a bit more

Encoding (the Good)

Page 6: Cryptanalysis - basic ciphers and a bit more

Encryption (the Bad)

• A reversible way of hiding information.

• Initially used to deliver secret military messages

• Two kinds of encryptions:

– Symmetric key encryption

– Public key encryption

• Examples: RSA, AES, Blowfish, etc.

Page 7: Cryptanalysis - basic ciphers and a bit more

Encryption example

• Caesar’s Box

• Not actually known if used by Caesar

Page 8: Cryptanalysis - basic ciphers and a bit more

Decrypt this

• CLNGS IISOA BYTSD ANTRO CIDGG

IEUOS EEROA RDTNZ ANKFE HMZTS

IITEE ZUONR HHSZ

Page 9: Cryptanalysis - basic ciphers and a bit more

Hashing (the Ugly) • A method of giving a unique key (called hash)

to some data.

• The same input will always produce the same output

• Multiple disparate inputs should not produce the same output.

• It should not be possible to go from the output to the input.

• Any modification of a given input should result in drastic change to the hash (avalanche effect).

Page 10: Cryptanalysis - basic ciphers and a bit more

A simple hashing algorithm

StringHashFunction(string, length)

sum ← 0

for (i = 1..length-1)

sum ← sum + string[i] * 31(length - 1 - i)

return sum

Foo : 70822

F0oo : 2135050

Bar : 66547

Page 11: Cryptanalysis - basic ciphers and a bit more

Additive cipher, the real Caesar cipher

• Initially used by Julius Caesar

• Based on right-shifting (addition) or left-shifting (subtraction) of letters of the alphabet

A=0, B=1, C=2, …, W=22, X=23, Y=24, Z=25

26mod

26mod

nxxD

nxxE

n

n

Page 12: Cryptanalysis - basic ciphers and a bit more

Additive example: key 23

Ciphertext: QEFSF SXEFA ABKJB PPXDB

Plaintext : ?

WVUTSRQPONMLK

ZYXWVUTSRQPON

JIHGFEDCBAZYX

MLKJIHGFEDCBA

Page 13: Cryptanalysis - basic ciphers and a bit more

Affine ciphers

• Very similar to additive ciphers

• Becomes additive cipher when a = 1

• Vulnerable to letter frequency

26mod

26mod

1 bxaxD

baxxE

Page 14: Cryptanalysis - basic ciphers and a bit more

Letter frequency

Page 15: Cryptanalysis - basic ciphers and a bit more

Affine cipher: example

• Plaintext: THIS IS AN EXAMPLE OF AFFINE CIPHER

• Key: a = 7, b = 11

• Ciphertext: OIPHP HLYNQ LRMKN FULUU PYNZP MINA

Page 16: Cryptanalysis - basic ciphers and a bit more

Enigma Machine

Page 17: Cryptanalysis - basic ciphers and a bit more

Enigma Machine Simulator

http://enigmaco.de/enigma/enigma.swf

Page 18: Cryptanalysis - basic ciphers and a bit more

One-Time Pad: The secure cipher

• Most secure feature: Random encryption key

H E L L O

7 (H) 4 (E) 11 (L) 11 (L) 14 (O)

+ 23 (X) 12 (M) 2 (C) 10 (K) 11 (L)

= 30 16 13 21 25

= 4 (E) 16 (Q) 13 (N) 21 (V) 25 (Z)

HELLO → EQNVZ

message; key; key+message; key+message (mod 26)

Page 19: Cryptanalysis - basic ciphers and a bit more

Modern Cryptography

Symmetric key

Public key

Page 20: Cryptanalysis - basic ciphers and a bit more

Symmetric key cryptography

• The same key is used for both encoding and decoding

• Examples:

– Blowfish - the base of Bcrypt

– SAFER+/++ - used by Bluetooth technology

– IDEA - International Data Encryption Algorithm

Page 21: Cryptanalysis - basic ciphers and a bit more

Public key cryptography

Page 22: Cryptanalysis - basic ciphers and a bit more

Small challenge

57 69 74 68 20 67 72 65 61 74 20 70 6F 77 65 72 20 63 6F 6D 65 73 20 67 72 65 61 74 20 72 65 73 70 6F 6E 73 69 62 69 6C 69 74 79 2C 20 68 69 67 68 20 76 6F 6C 74 61 67 65 20 61 6E 64 20 68 69 67 68 20 63 75 72 72 65 6E 74 2E

Decrypt the above message