12
CRYPTOGRAPHY AND THE MATH MAJOR Dr. Mihai Caragiu Mathematics Department Ohio Northern University

CRYPTOGRAPHY AND THE MATH MAJOR Dr. Mihai Caragiu Mathematics Department Ohio Northern University

Embed Size (px)

Citation preview

Page 1: CRYPTOGRAPHY AND THE MATH MAJOR Dr. Mihai Caragiu Mathematics Department Ohio Northern University

CRYPTOGRAPHY

AND THE MATH MAJOR   

Dr. Mihai Caragiu

Mathematics DepartmentOhio Northern University

Page 2: CRYPTOGRAPHY AND THE MATH MAJOR Dr. Mihai Caragiu Mathematics Department Ohio Northern University

Cryptography: the art or science of transforming an intelligible message into one that is unintelligible, and then retransforming that message back to its original form…

Page 3: CRYPTOGRAPHY AND THE MATH MAJOR Dr. Mihai Caragiu Mathematics Department Ohio Northern University

Mathematics plays a crucial role in cryptography!

Page 4: CRYPTOGRAPHY AND THE MATH MAJOR Dr. Mihai Caragiu Mathematics Department Ohio Northern University

2000 years ago Julius Caesar used a simple substitution cipher (replace each letter of message by a letter a fixeddistance – k – away)

Say, for example, k = 3. Then

SCIENCE

transforms into:  

VFLHQFH

This is not a secure cryptosystem! Still, there is some mathematics hidden here which is indeed very useful for the design of more reliable cryptosystems…

Page 5: CRYPTOGRAPHY AND THE MATH MAJOR Dr. Mihai Caragiu Mathematics Department Ohio Northern University

MODULAR ARITHMETIC   

First let us associate numbers from 0 through 25 to the twenty six letters of the English alphabet:  

 

A 0B 1C 2D 3E 4

…X 23Y 24Z 25

  

Now, let us learn how to compute “modulo 26”. This means computing within a “universe” in which the only available numbers are those from 0 through 25: 

U = {0, 1, 2, …, 25}

Page 6: CRYPTOGRAPHY AND THE MATH MAJOR Dr. Mihai Caragiu Mathematics Department Ohio Northern University

  

U = {0, 1, 2, …, 25} 

What about the other numbers? 26, 27, …  

Well, 26 is 0 in disguise!27 is 1 in disguise!

…531 is 11 in disguise!– 17 is 9 in disguise!

  

To “see” the “real face” of an integer modulo 26,divide it by 26 and take the remainder.

 What about 2001?2001 = 26 · 76 + 25

 Technically we denote this by 2001 (mod 26) = 25

 Therefore 2002 will be simply… 0 (modulo 26) !

  

Page 7: CRYPTOGRAPHY AND THE MATH MAJOR Dr. Mihai Caragiu Mathematics Department Ohio Northern University

 How to add mod 26, then?

Well, add as usual, then take the remainder!17 + 15 = 6

22 + 18 = 14… 

   

  How to multiply?

Multiply as usual, then take the remainder!15 · 17 = 21

11 · 5 = 3… 

 

 

 Caesar’s cipher in modular arithmetic:

X X + 3 (mod 26) 

Decryption:X X – 3 (mod 26)

Page 8: CRYPTOGRAPHY AND THE MATH MAJOR Dr. Mihai Caragiu Mathematics Department Ohio Northern University

VARIATIONS OF THE CAESAR’S CIPHERAFFINE SUBSTITUTIONSX a · X + b ( mod 26 ) 

a,b are elements of U, and a is relatively prime to 26

EXAMPLE: a = 7, b = 5 gives the following letter-by-letter encryption : X 7·X + 5 ( mod 26 )

A(0) F(5)B(1) M(12)C(2) T(19)D(3) A(0)E(4) H(7)F(5) Q(14)G(6) V(21)H(7) C(2)I(8) J(9)J(9) Q(16)

K(10) X(23)L(11) E(4)M(12) L(11)N(13) S(18)O(14) Z(25)P(15) G(6)Q(16) N(13)R(17) U(20)S(18) B(1)T(19) I(8)U(20) P(15)V(21) W(22)W(22) D(3)X(23) K(10)Y(24) R(17)Z(25) Y(24)

Page 9: CRYPTOGRAPHY AND THE MATH MAJOR Dr. Mihai Caragiu Mathematics Department Ohio Northern University

INVERTING THE AFFINE CIPHER   

X 7·X + 5 ( mod 26 )(encryption formula)

  

THE “INVERSE TRANSFORMATION”X 15·X + 3 (mod 26)(decryption formula)

  

EXAMPLE

Say, by using the encryption formula Alice encrypts “11” into 7·11 + 5 = 4 ( mod 26 )

and sends “4” over to Bob… 

Bob gets the “4” and wants to decrypt it by using the decryption formula. He computes:

4·15 + 3 = 63 = 52 + 11 = 11 (mod 26)and thus he recovers the “11”.

Page 10: CRYPTOGRAPHY AND THE MATH MAJOR Dr. Mihai Caragiu Mathematics Department Ohio Northern University

UNFORTUNATELY,letter-by-letter encryption is easy to break

(for example, by using a frequency analysis) 

EXAMPLE:  

Assume a smart eavesdropper Q suspects that Alice andBob use an encryption of the type described above, that is,X a·X+b (mod 26). But Q does not know the values ofa and b. Well, Q keeps listening, and after a few moments

realizes that the letter that has the highest frequency in the(otherwise unintelligible) cyphertext that Alice is sendingover is H (7). Moreover, Q realizes that the letter comingnext in the order of frequency is I (8). At this moment Q

quickly opens a linguistics book and finds out that theletters having the two highest frequencies in English are

E (4) (highest) and T (19) (second highest frequency).Finding a and b is not difficult: indeed, the encryption of

4 must be 7 and the encryption of 19 must be 8:a·4+b =7 (mod 26)

a·19+b =8 (mod 26)This is a system of two equations with two unknowns (in

modular arithmetic though), which is not difficult to solve. 

Page 11: CRYPTOGRAPHY AND THE MATH MAJOR Dr. Mihai Caragiu Mathematics Department Ohio Northern University

a·4+b =7 (mod 26) a·19+b =8 (mod 26) 

Substract the first equation out of the second to get 15·a = 1 (mod 26) from where a follows to be 7 [just check: 15·7=105 = 26·4+1=1 (mod 26); as a math major you will find out efficient ways of solving such equations of

degree one in modular arithmetic). Once we know a=7, replace this value back into one of the two equations and you will find

b=7 – a·4= 7 –7·4 = –21 = 5 (mod 26).

Page 12: CRYPTOGRAPHY AND THE MATH MAJOR Dr. Mihai Caragiu Mathematics Department Ohio Northern University

TOPICS CRUCIAL TO CRYPTOGRAPHYA MATH MAJOR WILL GET TO KNOW:

  

 BBasic modular arithmetic.

 

PPrime numbers and factoring large integers.

 

AAlgorithms in number theory.

 

AAlgebra of matrices and polynomials.