Docsity

Cryptography: A Historical Perspective and Techniques - Prof. Marie-Christine Brunet, Study notes of Electrical and Electronics Engineering

Toggle sidebar
bg1
ECE 110 M.-C. Brunet
Coding for Security: Cryptography Handout 20
M.-C. BRUNET ECE 110 UIUC 20.1
Coding for Security:
Cryptography
= secret writing.
It is a form of coding to make information
difficult to read or be understood by others.
Cryptography
ÆSecurity
ÆEncryption
science of unscrambling a
message without knowledge of the encryption
method. The same skills are required for:
Cryptoanalysis:
ÆPolish Rejewski’s attack on Enigma
ÆRosetta Stone. Champollion (1824)
Cryptography has influenced the course of many
battles, political events and decisions.
ÆJulius Caesar, (~50BC) used secret writing
ÆLouis XIV, “the man in the iron mask”.
ÆWWI, politics US-Germany.
ÆWWII, Enigma machine.
Cryptography is an unusual science: many
breakthroughs were kept secret for many
years, and scientists were not recognized
for their discoveries (ideas were classified
confidential for political reasons).
M.-C. BRUNET ECE 110 UIUC 20..2
An ongoing battle between “codemakers” and
“codebreakers” has generated numerous
contributions to many subjects, Mathematics,
Linguistics, Information Theory.
The true revolution in cryptography is the
concept of public key.
Example:
Alan Turing broke the Enigma cipher -1940
(unknown by German for years).
James Ellis is the original inventor of the
public key concept – 1968 (1976, Diffie et al).
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Cryptography: A Historical Perspective and Techniques - Prof. Marie-Christine Brunet and more Study notes Electrical and Electronics Engineering in PDF only on Docsity!

M.-C. BRUNET

ECE 110

UIUC

Coding for Security:

Cryptography

= secret writing.

It is a form of coding to make informationdifficult to read or be understood by others.

Cryptography

Æ

Security

Æ

Encryption

science of unscrambling a

message without knowledge of the encryptionmethod. The same skills are required for:

Cryptoanalysis:

Æ

Polish Rejewski’s attack on Enigma

Æ

Rosetta Stone. Champollion (1824)

Cryptography has influenced the course of manybattles, political events and decisions.

Æ

Julius Caesar, (~50BC) used secret writing

Æ

Louis XIV, “the man in the iron mask”.

Æ

WWI, politics US-Germany.

Æ

WWII, Enigma machine.

Cryptography is an unusual science: manybreakthroughs were kept secret for manyyears, and scientists were not recognizedfor their discoveries (ideas were classifiedconfidential for political reasons).

M.-C. BRUNET

ECE 110

UIUC

An ongoing battle between “codemakers” and“codebreakers” has generated numerouscontributions to many subjects, Mathematics,Linguistics, Information Theory.The true revolution in cryptography is theconcept of public key.

Example:Alan Turing broke the Enigma cipher -1940(unknown by German for years).James Ellis is the original inventor of thepublic key concept – 1968 (1976, Diffie et al).

M.-C. BRUNET

ECE 110

UIUC

Definitions

Cryptography

refers to secret communication

(by extension).Codes & Ciphers

are techniques to disguise a

message so that only the intended recipient canread it.Code: disguise

words

, Cipher: disguise

letters

.

Key

is a unique numeric or symbolic sequence

used to encrypt or decrypt information.Security

A good code: Keep the key secretHave lots of potential keys.

Problem of key distribution in a secure way.No code is 100% secure (codebreakers).

M.-C. BRUNET

ECE 110

UIUC

Steganography Cryptography

TranspositionSubstitution

MonoalphabeticPolyalphabetic

Secret Encoding

The message is hiddenThe message is scrambled

Each letter in a message retains itsidentity but changes its positionEach letter in a message changes itsidentity but retains its position

Ciphers

M.-C. BRUNET

ECE 110

UIUC

The Vigenere Square

It contains all possible Caesar shifts.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Encrypted letters in Caesar Shift 3Decrypted letters

M.-C. BRUNET

ECE 110

UIUC

Security Issues: Æ

This code is rather easy to crack! Æ

Small number of possible keys: Æ

Structure of language…. Example 2:

A Caesar shift 3 was used to encrypt thefollowing word. Decrypt it.F

R

P

P

X

Q

L

F

D

W

L

R

Q

Example 3:

A Caesar shift was used to encrypt thefollowing sentence. Decrypt it.U

X U W Q

O T Q Q E Q

M.-C. BRUNET

ECE 110

UIUC

Permutation Encoding

Letters are replaced by others in a more“random” way than simply shifting.The mapping is still reversible.Key: mapping for all letters (26 characters) Security Issues: Æ

Better code than Caesar shift. Æ

Many possible keys: 4. 10^ Æ

How to securely distribute the key? Example 4:

A

B

C

D

E

F

G ……………. Z

A

B

C

D

E

F

G

H

I ……… Z

Key =

FAÇADE will be encrypted as:

All monoalphabetic ciphers can be cracked!(using knowledge of language)

M.-C. BRUNET

ECE 110

UIUC

Polyalphabetic Ciphers Designed to beat frequency analysis. Vigenere Cipher

(1586)

For each letter in a message, a different cipheralphabet (Caesar shift) is used.Key: is a keytext = sequence of the alphabets used.

Example 5:

E N G I

N

E E

R I N G

Keytext: F D T A U M R P E A G

Encrypt the word

“Le Chiffre Indechiffrable”

Remarks:

M.-C. BRUNET

ECE 110

UIUC

Example 7:

Encrypt the text FOO using the

XOR function, and the key ECE. Use the 7-bitASCII coding for the letters.

ECE: 1 0 0 0 1 0 1

1 0 0 0 0 1 1

1 0 0 0 1 0 1

ECE: 1 0 0 0 1 0 1

1 0 0 0 0 1 1

1 0 0 0 1 0 1

Encrypted:

FOO: 1 0 0 0 1 1 0

1 0 0 1 1 1 1

1 0 0 1 1 1 1

Decrypted:To encrypt a longer message: repeat akeyword or use a sequence of keywords messagekeytextencryptedmessage

(bitsnotused)

Security Issues: Æ

It is not a very secure code if the key is a set of words. Better to generate a “random” key (arandom binary sequence).

M.-C. BRUNET

ECE 110

UIUC

M.-C. BRUNET

ECE 110

UIUC

Modulo Function

A modulo N = A mod Nis the remainder when dividing A by N

0 < A mod N < N-

A = p*N + (A mod N)

remainder

Example 8:

5 mod 8 =10 mod 6 =39 mod 10 = Another way to look at Modulo(example with mod 6)divide a circle in 6 parts: 0 to 5.A modulo 6 is the number onwhich we land when starting at 0,and advancing by “A” positions.

0

(^12)

3

5 4

Try 10 mod 6 again!

M.-C. BRUNET

ECE 110

UIUC

M.-C. BRUNET

ECE 110

UIUC

Pseudo-Random Number Generator^ This is used to generate the random key(the bit sequence).

X(0) is called the seed, and it is given.X(1), X(2), X(3), … is the key and it isgenerated by using the recursion:

X(k+1) = (A*X(k) + B) mod N

= PRNG(A, B, N)

Some generators are better than others (randomness).

Example 9

: N = 16, B = 6

(a) X(0) = 5, A = 4

X(1) = (4 x

5 + 6) mod 16 =

X(2) = (4 x

    1. mod 16 =

X(3) = (4 x

    1. mod 16 =

(b) X(0) = 35, A = 5

X(1) = (5 x 35 + 6) mod 16 =X(2) = (5 x

    1. mod 16 =

X(3) = (5 x

    1. mod 16 =

M.-C. BRUNET

ECE 110

UIUC

M.-C. BRUNET

ECE 110

UIUC

Generating the keytext Once the sequence X(1), X(2), X(3), …has beengenerated using PRNG (A, B, N), each decimalnumber X(k) is coded on log

N bits (= p, if N = 2

).

The resulting binary sequence is the keytext.

Maximum length of the keytext The maximum possible length of the sequence is: Æ

N decimal numbers, since it generates only numbers between 0 and N-1 (it will repeat after N hits at most) Æ

Max length = N * log

N binary numbers.

Back to Example 9

:

In part (b),the decimal sequence is:Since N=16, 4 bits will be used for each decimal,and the keytext is: Back to Example 9

:

In part (b), the maximum length is 16 x 4 = 64

2

2

p

M.-C. BRUNET

ECE 110

UIUC

M.-C. BRUNET

ECE 110

UIUC

Public-Key Implementation

Uses the mathematical function Modulo.C

mod N has very erratic behavior: as p increases,

C

increase, but C

mod N is not predictable.

and is not possible to reverse: if C, N are known, andK= C

mod N is known, it is not possible to find p.

It can be shown that[C

mod N]

mod N = [C

mod N]

mod N

= C

mod N

The process uses C

mod N as the key X(0), seed

for the PRNG seen previously (to form the keytext).

p

p

p

b

a

b

a

ab

ab

p

M.-C. BRUNET

ECE 110

UIUC

M.-C. BRUNET

ECE 110

UIUC

Public-Key Implementation

N, and C are public (known).

0 < C < N-

Alice and Bob have their own private key,a for Alice, and b for Bob (never communicated!)

Alice computesP = C

mod N

Alice sends Pto BobAlice receives Qfrom BobAlice computesK

= Q

mod N

(Æ

encrypt message)

a

a

a

Bob computesQ = C

mod N

Bob sends Qto AliceBob receives Pfrom AliceBob computesK

= P

mod N

(Æ

decrypt message)

b

b

b

K

= K

= X(0) is known to Alice and Bob only!

Even if P and Q are intercepted during theexchange, it is impossible to retrieve the keyX(0) without knowing either Alice or Bob’sprivate key (a or b).

a

b

M.-C. BRUNET

ECE 110

UIUC

M.-C. BRUNET

ECE 110

UIUC

Alice computesP = 5^ It is a secure process, but it is long, and requiressynchronization (exchange of P and Q).A better way is RSA: does not use XOR for theencryption, or decryption, but Modulo. The keyto decrypt is private and different from the oneto encrypt (public). RSA are the initials Rivest,Shamir, and Adleman (creators of the code).

mod 11 =

Alice sends Pto Bob, and receivesQ from BobAlice computesK

= Q

mod 11

=

2

2

2

Bob computesQ = 5

mod 11 =

Bob sends Qto Alice and receivesP from AliceBob computesK

= P

mod 11

=

4

4

4

Example 10

: (with small numbers to make it

computable by hand….)N = 11, C = 5 (notice 5 < 11)Alice’s private key: 2

Bob’s private key: 4

Alice will use K

=

to encrypt

Bob will use K

=

to decrypt

2 4

M.-C. BRUNET

ECE 110

UIUC

M.-C. BRUNET

ECE 110

UIUC

1 SOLUTIONS:

1

A Caesar shift was used to encrypt theFollowing sentence. Decrypt it. (hint: lookat double letters, and try possibilities)WH WG CDSBWBU KSSY TCF POGSPOZZ

It is opening week for baseball Encrypt the message below using theVigenere cipher and the keyword FRANCE.CANNOT WAIT FOR THE BREAK

2

2

HRNAQX BRIG HSW KHR DVJRK