Docsity

Classical Cryptography - Cryptography - Lecture Slides, Slides of Cryptography and System Security

Partial preview of the text

Download Classical Cryptography - Cryptography - Lecture Slides and more Slides Cryptography and System Security in PDF only on Docsity!

Classical Cryptography

2

Classical Cryptosystem

A CRYPTOSYSTEM is a 5-tuple

(P , C , K , E , D ) satisfying

  1. P is a finite set of possible plaintexts
  2. C is a finite set of possible ciphertexts
  3. K is a finite set of possible keys
  4. E is a finite set of encryption rules indexed by K so for each K โˆˆ K there is a function eK : P โ†’ C
  5. D is a finite set of decryption rules indexed by K so for each K โˆˆ K there is a function d (^) K : C โ†’ P
  6. for each K โˆˆ K , d (^) K โ—ฆ eK = identity

4

Shift Cipher disk

5

Shift Cipher

  • denotes the set {0, 1, ... , 25} with addition and multiplication taken modulo 26 The shift cipher is the cryptosystem defined by taking

Letters are identified with numbers: A=0, B=1, .... , Z= Z 26 P = C = K = Z 26 eK ( x ) = ( x + K ) mod 26 dK ( y ) = ( y โˆ’ K ) mod 26

7

Ring

  • Often, addition too easily cracked
  • Extra structure obfuscates: multiplication DEF: A commutative ring is a 3-tuple ( R,+, ยท ) which satisfies:
  1. ( R,+ ) is a commutative group
  2. R is closed under โ€œ ยท โ€ - which is associative, commutative and has identity
  3. Distributive: 1 โˆˆ R โˆ€ x , y , z โˆˆ R , x ( y + z ) = xy + xz and ( x + y ) z = xz + yz

8

Translational Group

Cipher

Taking any group G (even non-commutative) can generalize shift cipher by using G โ€™s โ€œadditionโ€ rule:

  • G is translated by the element K P = C = K = G eK ( x ) = x + K and dK ( x ) = x + (โˆ’ K )

10

Field

  • When almost every element in ring is invertible (except 0 which canโ€™t be) ring is called field DEF: A field is a commutative ring F such that F* = F - {0}
  • Z 26 is not a field

11

and the Euler

Phi Function

DEF: The ring is the set with addition and multiplication taken mod m. LEMMA: x is invertible in iff gcd(x, m) = 1. COR: is a field iff m is prime. DEF:. In other words, is the number of elements in which are relatively prime to m.

Z

m

!( m )

!( m ) = |Z โˆ— m | Z m !( m ) Z m { 0 , 1 ,... , m โˆ’ 1 } Z m Z m

13

Affine Ring Cipher

Can define a general cipher over any ring, even non-commutative rings (where multiplication non-commutative, but addition commutative).

  • For K = ( a, b )
  • When this is the affine cipher. P = C = R K = R โˆ— ร— R R = Z 26 eK ( x ) = ax + b and dK ( y ) = a โˆ’ 1 ( y โˆ’ b )

14

Substitution Cipher

Shift and Affine cipher have limited key spaces. Better to use all possible permutations of :

  • consists of all permutations of.
  • In practice, may use keyword to remember. Z 26 P = C = Z 26 K Z 26 e! ( x ) = !( x ) and d! ( y ) =! โˆ’ 1 ( y ) ! !

16

Modular Matrix Inverse

THM: Let A be a square matrix whose entries are in. A is invertible modulo m iff det( A ) is invertible in. Furthermore the inverse of A mod- m is given by where is the inverse of A over.

  • is computed using Gaussian elimination, Cramerโ€™s rule, etc. Z m Z m A โˆ’ 1 mod m = (det( A ) โˆ’ 1 mod m ) ยท (det( A ) ยท A โˆ’ 1 ) A R โˆ’ 1 A โˆ’ 1

17

Inverting modular

matrices in matlab

  1. (^) Define the matrix A using nested brackets.
  2. (^) Compute the determinant d and store it.
  3. (^) Determine if d is relatively prime to 26. If not, matrix not invertible so STOP.
  4. (^) ELSE, invert d mod-26 using extended gcd and store value in e.
  5. (^) Invert A in matlab, multiply result by d*e, and reduce mod-

19

matlab example 2

**>> A = [ [21 10] ; [18 5] ];

d = det(A) d = - [g, e, t] = gcd(d,26) g = 1 e = 9 t = 26 B = A^- B = -0.0667 0. 0.2400 -0. B = Bde B = 45.0000 -90. -162.0000 189. B = round(B) B = 45 - -162 189 B = mod(B,26) B = 19 14 20 7 C = AB C = 599 364 442 287 mod(C,26) ans = 1 0 0 1*

20

Hill Cipher patent