Mat 140 Cryptology Day 3 Presentation

Preview:

DESCRIPTION

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

Citation preview

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 rtalbert@franklincollege.edu

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

Unicode

Worldwide standard for representing characters from the keyboard and various languages

in numerical form

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

Decimal representation

Base 10 or “decimal” representation

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

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

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

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

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

http://www.thinkgeek.com

Binary representation of text

B

Binary representation of text

B 66Unicode

Binary representation of text

B 66Unicode

1000010Convert decimal

to binary

Binary representation of text

B 66Unicode

1000010Convert decimal

to binary01000010

Pad with extra 0

Binary representation of text

B 66Unicode

1000010Convert decimal

to binary01000010

Pad with extra 0

8-bit ASCII representation of “B”

Adding bits and bitstrings

“XOR”

Adding bits and bitstrings

0 ⊕ 0 = 0

“XOR”

Adding bits and bitstrings

0 ⊕ 0 = 0

1 ⊕ 0 = 1

“XOR”

Adding bits and bitstrings

0 ⊕ 0 = 0

1 ⊕ 0 = 1

0 ⊕ 1 = 1

“XOR”

Adding bits and bitstrings

0 ⊕ 0 = 0

1 ⊕ 0 = 1

0 ⊕ 1 = 1

1 ⊕ 1 = 0

“XOR”

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

Simple XOR cipher

[Choose bitstring for key]

11011010

11011010

Simple XOR cipher

[Choose bitstring for key]

11011010

11011010

DOG

Simple XOR cipher

[Choose bitstring for key]

11011010

11011010

DOG 01000100 01001111 01000111

Simple XOR cipher

[Choose bitstring for key]

11011010

11011010

DOG 01000100 01001111 01000111 ⊕11011010 11011010 11011010

Simple XOR cipher

[Choose bitstring for key]

11011010

11011010

DOG 01000100 01001111 01000111 ⊕11011010 11011010 11011010

10011110 10010101 10011101

Simple XOR cipher

[Choose bitstring for key]

11011010

11011010

DOG 01000100 01001111 01000111 ⊕11011010 11011010 11011010

10011110 10010101 10011101

쇦뷵쇝10011110 10010101 10011101

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

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

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

Activity: Experiments with the XOR cipher

When key length ≥ message length

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

key = ciphertext ⊕ plaintext

When key length ≥ message length

11001100 01010011 11111111Ciphertext

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

key = ciphertext ⊕ plaintext

When key length ≥ message length

11001100 01010011 11111111Ciphertext

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

key = ciphertext ⊕ plaintext

01000011 01000001 01010100Plaintext (CAT)

When key length ≥ message length

11001100 01010011 11111111Ciphertext

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

key = ciphertext ⊕ plaintext

10001111 00010010 1010101101000011 01000001 01010100Plaintext (CAT)

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)

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)

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)

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

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

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