mat 140 cryptology day 3 presentation

41
Cryptology Day 3: First look at computer ciphers MAT 140: Introduction to the Mathematical Sciences 19 September 2008 Robert Talbert, PhD Associate Professor of Mathematics and Computing Science [email protected]

Upload: robert-talbert

Post on 16-May-2015

804 views

Category:

Education


2 download

DESCRIPTION

Bits, binary numbers, the XOR cipher, perfect security and one-time pads. For MAT 140: Introduction to the Mathematical Sciences, at Franklin College.

TRANSCRIPT

Page 1: Mat 140 Cryptology Day 3 Presentation

CryptologyDay 3: First look at computer ciphers

MAT 140: Introduction to the Mathematical Sciences19 September 2008

Robert Talbert, PhDAssociate Professor of Mathematics and Computing Science [email protected]

Page 2: Mat 140 Cryptology Day 3 Presentation

Recap of Day 2

• Integer congruence modulo n

•Using integer congruence to make and break shift ciphers

• Idea: Representing text characters as numbers and then using math to manipulate them

Page 3: Mat 140 Cryptology Day 3 Presentation

Unicode

Worldwide standard for representing characters from the keyboard and various languages

in numerical form

Page 4: Mat 140 Cryptology Day 3 Presentation

Bits and bytes

Computers store and process information in binary states,

represented by 0 (off) or 1 (on).

Bit = Binary Digit = 0 or 1.Byte = 8 bits, e.g. 01101110

Every positive integer can be represented as a string of bits...

Page 5: Mat 140 Cryptology Day 3 Presentation

Decimal representation

Base 10 or “decimal” representation

461 = 400 + 30 + 1= 4! 102 + 3! 101 + 1! 100

Page 6: Mat 140 Cryptology Day 3 Presentation

Binary representation

461 = 256 + 128 + 64 + 8 + 4 + 1= 1! 28 + 1! 27 + 1! 26 + 0! 25 + 0! 24

+1! 23 + 1! 22 + 0! 21 + 1! 20

Page 7: Mat 140 Cryptology Day 3 Presentation

Binary representation

461 = 256 + 128 + 64 + 8 + 4 + 1= 1! 28 + 1! 27 + 1! 26 + 0! 25 + 0! 24

+1! 23 + 1! 22 + 0! 21 + 1! 20

Page 8: Mat 140 Cryptology Day 3 Presentation

Binary representation

461 = 256 + 128 + 64 + 8 + 4 + 1= 1! 28 + 1! 27 + 1! 26 + 0! 25 + 0! 24

+1! 23 + 1! 22 + 0! 21 + 1! 20

461 in base 10 = 111001101 in base 2Binary representation

Page 9: Mat 140 Cryptology Day 3 Presentation

Binary representation

461 = 256 + 128 + 64 + 8 + 4 + 1= 1! 28 + 1! 27 + 1! 26 + 0! 25 + 0! 24

+1! 23 + 1! 22 + 0! 21 + 1! 20

461 in base 10 = 111001101 in base 2Binary representation

The number 461 is a 9-bit integer.Number of bits in an integer n:

!log2 n" + 1

Page 10: Mat 140 Cryptology Day 3 Presentation

http://www.thinkgeek.com

Page 11: Mat 140 Cryptology Day 3 Presentation

Binary representation of text

B

Page 12: Mat 140 Cryptology Day 3 Presentation

Binary representation of text

B 66Unicode

Page 13: Mat 140 Cryptology Day 3 Presentation

Binary representation of text

B 66Unicode

1000010Convert decimal

to binary

Page 14: Mat 140 Cryptology Day 3 Presentation

Binary representation of text

B 66Unicode

1000010Convert decimal

to binary01000010

Pad with extra 0

Page 15: Mat 140 Cryptology Day 3 Presentation

Binary representation of text

B 66Unicode

1000010Convert decimal

to binary01000010

Pad with extra 0

8-bit ASCII representation of “B”

Page 16: Mat 140 Cryptology Day 3 Presentation

Adding bits and bitstrings

“XOR”

Page 17: Mat 140 Cryptology Day 3 Presentation

Adding bits and bitstrings

0 ⊕ 0 = 0

“XOR”

Page 18: Mat 140 Cryptology Day 3 Presentation

Adding bits and bitstrings

0 ⊕ 0 = 0

1 ⊕ 0 = 1

“XOR”

Page 19: Mat 140 Cryptology Day 3 Presentation

Adding bits and bitstrings

0 ⊕ 0 = 0

1 ⊕ 0 = 1

0 ⊕ 1 = 1

“XOR”

Page 20: Mat 140 Cryptology Day 3 Presentation

Adding bits and bitstrings

0 ⊕ 0 = 0

1 ⊕ 0 = 1

0 ⊕ 1 = 1

1 ⊕ 1 = 0

“XOR”

Page 21: Mat 140 Cryptology Day 3 Presentation

Adding bits and bitstrings

0 ⊕ 0 = 0

1 ⊕ 0 = 1

0 ⊕ 1 = 1

1 ⊕ 1 = 0

“XOR”

110011 ⊕ 101010 110011⊕ 101010

011001

Any bit XOR-ed to itself = 0

Page 22: Mat 140 Cryptology Day 3 Presentation

Simple XOR cipher

[Choose bitstring for key]

11011010

11011010

Page 23: Mat 140 Cryptology Day 3 Presentation

Simple XOR cipher

[Choose bitstring for key]

11011010

11011010

DOG

Page 24: Mat 140 Cryptology Day 3 Presentation

Simple XOR cipher

[Choose bitstring for key]

11011010

11011010

DOG 01000100 01001111 01000111

Page 25: Mat 140 Cryptology Day 3 Presentation

Simple XOR cipher

[Choose bitstring for key]

11011010

11011010

DOG 01000100 01001111 01000111 ⊕11011010 11011010 11011010

Page 26: Mat 140 Cryptology Day 3 Presentation

Simple XOR cipher

[Choose bitstring for key]

11011010

11011010

DOG 01000100 01001111 01000111 ⊕11011010 11011010 11011010

10011110 10010101 10011101

Page 27: Mat 140 Cryptology Day 3 Presentation

Simple XOR cipher

[Choose bitstring for key]

11011010

11011010

DOG 01000100 01001111 01000111 ⊕11011010 11011010 11011010

10011110 10010101 10011101

쇦뷵쇝10011110 10010101 10011101

Page 28: Mat 140 Cryptology Day 3 Presentation

Simple XOR cipher

[Choose bitstring for key]

11011010

11011010

DOG 01000100 01001111 01000111 ⊕11011010 11011010 11011010

10011110 10010101 10011101

쇦뷵쇝10011110 10010101 10011101

⊕11011010 11011010 11011010

Page 29: Mat 140 Cryptology Day 3 Presentation

Simple XOR cipher

[Choose bitstring for key]

11011010

11011010

DOG 01000100 01001111 01000111 ⊕11011010 11011010 11011010

10011110 10010101 10011101

01000100 01001111 01000111

쇦뷵쇝10011110 10010101 10011101

⊕11011010 11011010 11011010

Page 30: Mat 140 Cryptology Day 3 Presentation

Simple XOR cipher

[Choose bitstring for key]

11011010

11011010

DOG 01000100 01001111 01000111 ⊕11011010 11011010 11011010

10011110 10010101 10011101

01000100 01001111 01000111 DOG

쇦뷵쇝10011110 10010101 10011101

⊕11011010 11011010 11011010

Page 31: Mat 140 Cryptology Day 3 Presentation

Activity: Experiments with the XOR cipher

Page 32: Mat 140 Cryptology Day 3 Presentation

When key length ≥ message length

Plaintext ⊕ key = ciphertextPlaintext ⊕ key ⊕ Plaintext = ciphertext ⊕ Plaintext

key = ciphertext ⊕ plaintext

Page 33: Mat 140 Cryptology Day 3 Presentation

When key length ≥ message length

11001100 01010011 11111111Ciphertext

Plaintext ⊕ key = ciphertextPlaintext ⊕ key ⊕ Plaintext = ciphertext ⊕ Plaintext

key = ciphertext ⊕ plaintext

Page 34: Mat 140 Cryptology Day 3 Presentation

When key length ≥ message length

11001100 01010011 11111111Ciphertext

Plaintext ⊕ key = ciphertextPlaintext ⊕ key ⊕ Plaintext = ciphertext ⊕ Plaintext

key = ciphertext ⊕ plaintext

01000011 01000001 01010100Plaintext (CAT)

Page 35: Mat 140 Cryptology Day 3 Presentation

When key length ≥ message length

11001100 01010011 11111111Ciphertext

Plaintext ⊕ key = ciphertextPlaintext ⊕ key ⊕ Plaintext = ciphertext ⊕ Plaintext

key = ciphertext ⊕ plaintext

10001111 00010010 1010101101000011 01000001 01010100Plaintext (CAT)

Page 36: Mat 140 Cryptology Day 3 Presentation

When key length ≥ message length

11001100 01010011 11111111Ciphertext

Plaintext ⊕ key = ciphertextPlaintext ⊕ key ⊕ Plaintext = ciphertext ⊕ Plaintext

key = ciphertext ⊕ plaintext

10001111 00010010 10101011

11001100 01010011 11111111Ciphertext

01000011 01000001 01010100Plaintext (CAT)

Page 37: Mat 140 Cryptology Day 3 Presentation

When key length ≥ message length

11001100 01010011 11111111Ciphertext

Plaintext ⊕ key = ciphertextPlaintext ⊕ key ⊕ Plaintext = ciphertext ⊕ Plaintext

key = ciphertext ⊕ plaintext

10001111 00010010 10101011

11001100 01010011 11111111Ciphertext

01000011 01000001 01010100Plaintext (CAT)

01000100 01001111 01000111Plaintext (DOG)

Page 38: Mat 140 Cryptology Day 3 Presentation

When key length ≥ message length

11001100 01010011 11111111Ciphertext

Plaintext ⊕ key = ciphertextPlaintext ⊕ key ⊕ Plaintext = ciphertext ⊕ Plaintext

key = ciphertext ⊕ plaintext

10001111 00010010 10101011

11001100 01010011 11111111Ciphertext

10001000 00011100 10111000

01000011 01000001 01010100Plaintext (CAT)

01000100 01001111 01000111Plaintext (DOG)

Page 39: Mat 140 Cryptology Day 3 Presentation

One-time pads and perfect security

When key length ≥ message length in the XOR cipher: No information about the real plaintext is given by the ciphertext.

= Perfect security

Page 40: Mat 140 Cryptology Day 3 Presentation

One-time pads and perfect security

When key length ≥ message length in the XOR cipher: No information about the real plaintext is given by the ciphertext.

= Perfect security

Given a plaintext ASCII message: Alice and Bob choose a random

string of bits at least as long as the message.

Encrypt using XOR. Burn the key.

= One-time pad

Page 41: Mat 140 Cryptology Day 3 Presentation

Next time

•The key distribution problem

•Public-key cryptography and RSA

•Wrapping up: Current cutting edge of cryptology; careers in cryptology and information security; cryptology at Franklin College