Docsity

Hill Cipher and DES: Modern Encryption Algorithms and Their Attacks - Prof. Krzysztof Gaj, Study notes of Cryptography and System Security

Partial preview of the text

Download Hill Cipher and DES: Modern Encryption Algorithms and Their Attacks - Prof. Krzysztof Gaj and more Study notes Cryptography and System Security in PDF only on Docsity!

Towards modern ciphers

Data Encryption Standard

and its extensions

ECE 646 - Lecture 7

Hill Cipher

C[1xd] = M[1xd] · K[dxd]

(c 1 , c 2 , …, cd) = (m 1 , m 2 , …, md)

k 11 , k 12 , …, k1d

kd1, kd2, …, kdd

Encryption:

ciphertext block = message block · key matrix

Hill Cipher

M[1xd] = C[1xd] · K-1[dxd]

K[dxd] · K-1[dxd] =

Decryption:

where

key matrix · inverse key matrix = identity matrix

message block = ciphertext block · inverse key matrix

Hill Cipher

Example (1)

K[dxd] =

Z X

I X =^

K-1[dxd] =

X D

= S Z

K[dxd] · K-1[dxd] =

08 23 ·^

18 25 =^

Hill Cipher - Known Plaintext Attack (2)

c 11 , c 12 , …, c1d m 11 , m 12 , …, m1d c 21 , c 22 , …, c2d m 21 , m 22 , …, m2d ………………. ………………….. cd1, cd2, …, cdd md1, md2, …, mdd

k 11 , k 12 , …, k1d

k 21 , k 22 , …, k2d

kd1, kd2, …, kdd

C[dxd] = M[dxd] · K[dxd]

K[dxd] = M-1[dxd] · C[dxd]

One-time Pad

Vernam Cipher

Gilbert Vernam, AT&T Major Joseph Mauborgne

ci = mi ⊕ ki

mi ki ci

All bits of the key must be chosen at random and never reused

One-time Pad

Equivalent version

ci = mi + ki mod 26

mi ki ci

TO BE OR NOT TO BE

AX TC VI URD WM OF

TL UG JZ HFW PK PJ

All letters of the key must be chosen at random and never reused

Perfect Cipher

Claude Shannon Communication Theory of Secrecy Systems, 1948

m ∈ M c ∈ C

P(M= m | C= c ) = P(M = m )

The cryptanalyst can guess a message with the same probability without knowing a ciphertext as with the knowledge of the ciphertext

S-P Networks

S

S

S

S

....

P

S

S

S

S

....

P

S

S

S

S

.... .............

Basic operations of S-P networks

Permutation

S-box P-box

Substitution

0 0 0 1 1 1 0 0 1 1 0 0 1 0 0 0 0 1 1 1 0 1 1 0 1 1 1 0

Avalanche effect

S

S

S

S

....

P

S

S

S

S

....

P

S

S

S

S

.... ............. m m 1 m^2 m^34 m m 5 m^6 m^78

m m 9 m^10 m^1112

m m 61 m^62 m^6364

m 1 → (^) c 1 → c 1 c c 2 → c 2 c^3 4 c c 5 → c 5 c^6 c^78 →→^ cc^78

c c 9 c^10 c^1112 →^ c^11

c c 61 → c 61 c^6263 c 64 → c 64

LUCIFER

....

P

....

P

.... .............

Horst Feistel, Walt Tuchman IBM

S S

k1,

S S

k2,

S S

k3,

S S

k32, S S

k32, S S

k32,

S S

k2,

S S

k1, S S

k1,

S S

K2,

S S

K3, S S

k3,

16 rounds

m 1 m m 2 m^34 m 5 m m 6 m^78

m 9 m m 10 m^1112

m m 125 m^126 m^127128

c 1 c c 2 c^34 c 5 c c 6 c^78

c 9 c c 10 c^1112

c c 125 c^126 c^127128

DES - chronicle of events

1973 - NBS issues a public request for proposals for

a standard cryptographic algorithm

1975 - first publication of the IBM’s algorithm

and request for comments

1976 - NBS organizes two workshops to evaluate

the algorithm

1977 - official publication as

FIPS PUB 46: Data Encryption Standard

1983, 1987, 1993 - recertification of the algorithm

for another five years

1993 - software implementations allowed to be validated

Controversies surrounding DES

Unknown

design

criteria

Too short

key

Slow

in software

Reinvention of differential cryptanalysis

Most criteria reconstructed from cipher analysis

Theoretical designs of DES breaking machines

Only hardware implementations certified

Software, firmware and hardware treated equally

Practical DES cracker built

1990 (^19931998)

Life of DES

DES developed by IBM and NSA In common use for over 20 years

(^1970 1980 1990 2000) Time

Federal and banking standard

transision to a new standard

Over 300 validated implementations

De facto world-wide standard

Most popular secret-key ciphers

1980 1990 2000 2010 2020 2030

DES Triple DES American AES - Rijndael standards

Other popular algorithms

IDEA

AES contest

1977 1999

2001

Blowfish

RC

CAST

Twofish RC Mars

Serpent

128, 192, and 256 bit keys

56 bit key

112, 168 bit keys

Ln+1=Rn Rn+1=Ln⊕ f(Rn, Kn+1)

L 0 R 0 f

K 1

L 1 f K^2

L 2 R 2

L 15 R 15 f

K 16

R 16 L 16

IP-

IP

R 1

DES Main Loop

Feistel Structure

Ln Rn f

Ln+1 Rn+

Kn+

Ln Rn f

Ln+1 Rn+

Kn+

f Kn+

Feistel Structure

Encryption Decryption

??

??

Ln+1, Rn+

Ln, Rn

L 0 R 0 f

K 1

L 1 f

K 2

L 2 R 2

L 15 R 15 f

K 16

R 16 L 16

IP

IP-

R 1

R 16 L 16 f

K 16

R 15 f

K 15

R 14 L 14

R 1 L 1 f

K 1

L 0 R 0

IP-

IP

L 15

Decryption

Mangler Function of DES, F

Notation for S-boxes

i 1 i 2 i 3 i 4 i 5 i 6

Input

Output

o 1 o 2 o 3 o 4

i 1 i 6 determines a row number in the S-box table, 0.. i 2 i 3 i 4 i 5 determine a column in the S-box table, 0..

o 1 o 2 o 3 o 4 is a binary representation of a number from 0..15 in the given row and the given column

Linear Transformations

Transformations that fulfill the condition:

T(X[m x 1]) = Y[n x 1] = A[n x m] ⋅ X[m x 1]

or T(X 1 ⊕ X 2 ) = T(X 1 ) ⊕ T(X 2 )

Affine Transformations

Transformations that fulfill the condition:

T(X[m x 1]) = Y[n x 1] = A[n x m] ⋅ X[m x 1] ⊕ B[n x 1]

Linear Transformations of DES

IP, IP-1, E, PC1, PC2, SHIFT

e.g., IP(X 1 ⊕ X 2 ) = IP(X 1 ) ⊕ IP( X 2 )

Non-Linear and non-affine transformations of DES

S There are no such matrices A[4x6] and B[4x1] that

S(X[6x1]) = A[4x6] ⋅ X[6x1] ⊕ B[4x1]

Design of S-boxes

S

S[0..15]

in (^) out = S[in]

  • 16! ≈ 2 ⋅ 1013 possibilities
  • precisely defined initially unpublished criteria
  • resistant against differential cryptanalysis (attack known to the designers and rediscovered in the open research in 1990 by E. Biham and A. Shamir)

Initial transformation

Final transformation

#rounds times

Round Key[i] i:=i+

Round Key[0]

i:=

i<#rounds?

Cipher Round

Round Key[#rounds+1]

Typical Flow Diagram of

a Secret-Key Block Cipher