Top Banner
Computer Science 101 Cryptography Part I
25

Computer Science 101 Cryptography Part I

Feb 25, 2016

Download

Documents

tamira

Computer Science 101 Cryptography Part I. Notes based on. S. Singh, The Code Book: The Evolution of Secrecy from Mary, Queen of Scots to Quantum Cryptography . New York: Doubleday (1999) ‏. Terminology. Steganography – Hiding the message Under wax of wooden tablets Shaved heads - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Computer Science 101 Cryptography Part I

Computer Science 101

CryptographyPart I

Page 2: Computer Science 101 Cryptography Part I

Notes based on

• S. Singh, The Code Book: The Evolution of Secrecy from Mary, Queen of Scots to Quantum Cryptography. New York: Doubleday (1999)

Page 3: Computer Science 101 Cryptography Part I

Terminology

• Steganography – Hiding the message– Under wax of wooden tablets– Shaved heads– Within hardboiled eggs – special ink– Invisible ink– Embedded in pictures or tunes

Page 4: Computer Science 101 Cryptography Part I

Crypto: The Problem

ALICE

How do I love thee? Let me count the ways.I love thee to the depth and breadth and heightMy soul can reach, when feeling out of sightFor the ends of Being and ideal Grace.I love thee to the level of every day'sMost quiet need, by sun and candlelight.

abca adf adCIFASFDSFadfafdasf daf pua,kjpui8978*&( aadb adae-898adsf9898b @!!l;kjadsfdsa*()_*()kasjdf*(abac3(*_* ,DAD0-89adfafj&(D()8asdkljfasd;f(_casadfdasfA(()*Aafdafdfas*(ADFSF9-898DFDFSASFDFSDF(*DFSCDFS*(_*(DFS*(adfdsaf(*_)dafdas*ASFD9898-08DFSFDSad*(A(*

BOB

How do I love thee? Let me count the ways.I love thee to the depth and breadth and heightMy soul can reach, when feeling out of sightFor the ends of Being and ideal Grace.I love thee to the level of every day'sMost quiet need, by sun and candlelight.

abca adf adCIFASFDSFadfafdasf daf pua,kjpui8978*&( aadb adae-898adsf9898b @!!l;kjadsfdsa*()_*()kasjdf*(abac3(*_* ,DAD0-89adfafj&(D()8asdkljfasd;f(_casadfdasfA(()*Aafdafdfas*(ADFSF9-898DFDFSASFDFSDF(*DFSCDFS*(_*(DFS*(adfdsaf(*_)dafdas*ASFD9898-08DFSFDSad*(A(*

EVE

Page 5: Computer Science 101 Cryptography Part I

Terminology

• Cryptography – Hiding the meaning– Transposition – letters rearranged

• Rail fence• Wrap around wooden staff

– Substitution – substitute letter for letter, etc.• Caesar cypher – shift• Key in front (remove repeats – example next)

Page 6: Computer Science 101 Cryptography Part I

Example – Key at front

• Suppose we used GEORGE BOOLE as key. Then our encoding would be

ABCDEFGHIJKLMNOPQRSTUVWXYZGEORBLMNPQSTUVWXYZACDFHIJK

• Encoding "TOM WHALEY" would give

CWUHNGTBJ• This worked for a few centuries (1st millenium AD)

Page 7: Computer Science 101 Cryptography Part I

Muslim Scholars

• Mathematics, statistics, linguistics

• Abu Ja' far Muhammad ibn Musa Al-Khowasrizmi (algorithm)

• Algebra

• Cryptanalysis techniques described by al Kindi in 9th century

Page 8: Computer Science 101 Cryptography Part I

Frequency Analysis• For a given language (e.g., English), it is

known how often each letter occurs: Letter Percentagea 8.2b 1.5c 2.8d 4.3e 12.7...z 0.1

Page 9: Computer Science 101 Cryptography Part I

Frequency Analysis• So Eve just counts percentages in ciphertext

message, and decrypts it:Encrypted Percentage Decodedx 8.2 ac 1.5 bp 2.8 ct 4.3 df 12.7 e...b 0.1 z

Page 10: Computer Science 101 Cryptography Part I

Frequency Analysis• Only have to encrypt part of the message,

and then play “Wheel of Fortune”:

_ o _ d_ I _ _ _e _ _ee _ _et _e _ _ _ _t t_e _ _ _s.

• As length of ciphertext message increases, statistics become more applicable (less so for shorter messages)

Page 11: Computer Science 101 Cryptography Part I

Frequency Analysis• Encrypting pairs helps a lot, but then we

just use pairwise frequencies instead:

Pair Percentageaa 0.0001ab 0.002ac 0.003...zz 0.0005

Page 12: Computer Science 101 Cryptography Part I

Vigenère Ciphers (1586) 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 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 ZB 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 C 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 BD D E F G H I J K L M N O P Q R S T U V W X Y Z A B C E E F G H I J K L M N O P Q R S T U V W X Y Z A B C D F F G H I J K L M N O P Q R S T U V W X Y Z A B C D E G G H I J K L M N O P Q R S T U V W X Y Z A B C D E F H H I J K L M N O P Q R S T U V W X Y Z A B C D E F G ...

Z Z 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

– Alice uses a different row to encrypt each letter– She and Bob use a keyword to switch rows....

Page 13: Computer Science 101 Cryptography Part I

Vigenère Ciphers– E.g., keyword FADE:

Keyword F A D E F A D E F A D E F A D

Plaintext h o w d o i l o v e t h e e l

Ciphertext m 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 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

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

Page 14: Computer Science 101 Cryptography Part I

Vigenère Ciphers– E.g., keyword FADE:

Keyword F A D E F A D E F A D E F A D

Plaintext h o w d o i l o v e t h e e l

Ciphertext m o 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 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

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

Page 15: Computer Science 101 Cryptography Part I

Vigenère Ciphers– E.g., keyword FADE:

Keyword F A D E F A D E F A D E F A D

Plaintext h o w d o i l o v e t h e e l

Ciphertext m o z 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 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

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

Page 16: Computer Science 101 Cryptography Part I

Vigenère Ciphers– E.g., keyword FADE:

Keyword F A D E F A D E F A D E F A D

Plaintext h o w d o i l o v e t h e e l

Ciphertext m o z h 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 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

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

Page 17: Computer Science 101 Cryptography Part I

Vigenère Ciphers– E.g., keyword FADE:

Keyword F A D E F A D E F A D E F A D

Plaintext h o w d o i l o v e t h e e l

Ciphertext m o z h t 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 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

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

Page 18: Computer Science 101 Cryptography Part I

Vigenère Ciphers– Now the code for a word is different each time.– Alice must send Bob a new key often, or Eve may figure it out –

weakness!– Babbage (1854) : two instances of a common word (the, and, ...)

will occasionally look the same:

Keyword K I N G K I N G K I N G K I N G K I N G K I N GPlaintext t h e s u n a n d t h e m a n i n t h e m o o nCiphertext D P R Y E V N T N B U K W I A O X B U K W W B T

– Then use W-o-F techniques to decode.

Page 19: Computer Science 101 Cryptography Part I

Vigenère Ciphers– Solution: Use a key the length of the whole message:

Keyword P L M O E Z Q K I J Z L R T E A V C R C B Y N NPlaintext t h e s u n a n d t h e m a n i n t h e m o o nCiphertext I S Q G Y M Q X L C G P D T R I I V Y G N M B A

– Problem: making lots of truly random keys• People are lazy and will make patterns in keys• Truly random numbers are difficult to generate automatically (a

huge field)

– Bob & Alice share a “one-time-pad” of keys, one for each new message (or new day, week, ...)

Page 20: Computer Science 101 Cryptography Part I

Vigenère Ciphers

• Cracked by Charles Babbage in 1854

• Common word will occasionally be encrypted the same way.

Page 21: Computer Science 101 Cryptography Part I

The Enigma Machine (1926-1945)

– Alice types on keyboard.– Scramblers (rotors) randomly

wire keyboard to lamps.– Lamp shows encrypted letter.– Scrambler rotates as Alice types.– Scramblers can be removed and

swapped with each other.– Add a plugboard to randomize

some of the keyboard/scrambler connections.

Page 22: Computer Science 101 Cryptography Part I

The Enigma Machine– If Eve doesn't have an Enigma machine, she'll never decode a

message.– Assuming she has an exact copy of the machine, there are:

• 26*26*26 = 17,576 possible configurations of three scramblers

• Six possible orders of three scramblers for each such config• Millions or billions of ways of wiring plugboard• Therefore over 10,000,000,000,000,000 possible ways of

setting up the machine– So Eve must get an Enigma machine, and intercept the updated

Bob/Alice scrambler/plugboard settings.

Page 23: Computer Science 101 Cryptography Part I

Cracking the Enigma: Rejewski, Turing

• A combination of espionage, genius, and brute force:– Get hold of an enigma machine or blueprints– Obtain some knowledge about what's being

transmitted to eliminate most possibilities for initial setup:

• Part of initial setup was sometimes specified in message itself• Early-morning messages had the word weather in specific places

(crib: AXQEPAZ = weather)• Military messages are more rigidly structured (predictable) than

everyday language.

Page 24: Computer Science 101 Cryptography Part I

Cracking the Enigma: Rejewski, Turing

• A combination of espionage, genius, and brute force:– Build a model of how the machine operates, to

eliminate more possibilities • Isolate components; e.g., ignore the plugboard, and build a

model of the scramblers.• Check correlations between input and output:

– Put in M1, get C1– Put in M2, get C2– M1 is to C1 as M2 is to C2

– Check every remaining possibility.

Page 25: Computer Science 101 Cryptography Part I