Problem Session CMPE553 09042018
Problem Session CMPE553 09042018
Security” 09.04.2018
Classical Ciphers, S-DES, DES, Groups
1. Encryption and decryption by Feistel cipher
Lei =Rei−1
Rei =Lei−1 +F (Rei−1 , K i ) (1)
Le
Where i=1,..,16, and P=( 0
,Re 0 ) – original plaintext
Ciphertext is obtained by switching of last obtained results:
( Le 17 (Re
C=¿ (¿ ) )=¿ 16 (¿ ) )¿
( Re17 ¿ ( Le16 ¿ (2)
Decryption starts with ciphertext
C=( Ld 0 , Rd 0 ) (3)
In decryption process, similar to encryption, we have (taking into account reverse
order of round keys):
Ld i=Rd i−1
Rd i=Ld i−1 +F ( Rdi−1 , K 17−i )(4)
Taking into account (1)-(3), we get from (4) for i=1:
Rd 1=Ld 0 +F (Rd 0 , K 16 )=Re16 +F ( Le16 , K 16 )=
Le 15+F (Re15 , K 16 )+F ( Le16 , K 16 )=
Le 15+F (Re15 , K 16 )+F (Re15 , K 16 )=Le 15
Ld 1 =Rd 0 =Le 16=Re15 (5)
If to continue this process, we shall see that next decrypted values will be expressed
via respective encrypted values, and we make hypothesis that in general case holds:
Rd i=Le 16−i
Ld i=Re16−i (6)
Where i=1,..,16.
This is compatible with (5). Let’s show that (6) is valid when we proceed from i-th
term to (i+1)-st using (4):
Ld i+1 =Rd i=Le 16−i=Le 16−i =Re15−i=Re16−( i+1 )
Rd i+1 =Ld i +F( Rd i , K 16−i )=Re16−i +F( Le 16−i , K 16−i )=
Le 15−i +F ( Re15−i , K 16−i )+F (Re15−i , K 16−i )=Le15−i =Le16 −( i+1 )
(7)
Expression (7) is of the same shape as (6), but for the next value i=i+1. This proves
our hypothesis (6). From (6), we get that after 16-th round of decryption
Rd 16=Le 0 , Ld 16=Re0 . Switching obtained halves, we restore original plaintext P.
Hence, decryption sequence actually restores plaintext for any used transformation F.
3. Matrix inversion
(1 2 3
A=¿(4 ( 5 6 ¿ ) )¿ ¿¿
)
(7 8 8 ¿ A−1 −1
-? AA mod n=E n=10
a
(a11 a12 13
A−1 =¿ (a21 ( a22 ¿ )a 23 )¿
)a
(a31 a 32 33
¿
−1
ij i+ j
A =(−1 ) D ji /det ( A ) (1)
D
where ij - is a determinant of sub matrix of A, obtained by deletion of i-th row and j-
th column, det(A) – determinant of A. Taking into account that we work with integers
on modulo n, we rewrite (1):
−1
ij
det ( A ) A =(−1 )i+ j D ji mod n
(2)
det(A) =40+84+96-105-64-48=220-217=3
From (2):
3 A −1 −1
11 =40−48=−8 mod10=2 mod 10 , A11 =4
3 A −1 −1
21 =−(32−42 )=10 mod 10=0 mod 10 , A21 =0
3 A −1 −1
31 =32−35=−3 mod 10=7 mod 10 , A 31 =9
3 A −1 −1
12 =−(16−24 )=8 mod 10 , A12 =6
3 A −1 −1
22 =8−21=−13 mod 10=−3 mod 10=7 mod 10 , A22 =9
3 A −1 −1
32 =−( 8−14 )=6 mod 10 , A 32 =2
3 A −1 −1
13 =12−15=−3 mod 10=7 mod10 , A13 =9
3 A −1 −1
23 =−(6−12 )=6 mod 10 , A 23 =2
3 A −1 −1
33 =5−8=−3 mod10=7 mod 10 , A 33 =9
Thus, we get
(4 6 9
A−1=¿ (0 ( 9 ¿ )2 )¿
)9
(9 2 ¿
and
1 2 3 4 6 9 4 0 27 6 18 6 9 4 27
1
AA 4 5 6 0 9 2 16 0 54 24 45 12 36 10 54 mod 10
7 8 8 9 2 9 28 0 72 42 72 16 63 16 72
31 30 40 1 0 0
70 81 100 mod 10 0 1 0
100130151 0 01
4. Invert permutation:
P=(159742638)
P−1 =(168527493)
P(578632149)=(539167284)
P−1 (P(578632149))= P−1 (539167284)=(57863249)
5. Viginere cipher
We can code each letter by respective number:
a b c d e f g h i j k l m n o p q r s t U v w x y z
0 1 2 3 4 5 6 7 8 9 1 11 12 13 14 1 16 17 18 1 20 21 22 2 24 25
0 5 9 3
Then instead of letters we can use respective numbers. For example, we have 5
letters numbered from 0 to 4. Then, Viginere tableau will be as follows:
0 1 2 3 4
0 0 1 2 3 4
1 1 2 3 4 0
2 2 3 4 0 1
3 3 4 0 1 2
4 4 0 1 2 3
Top row has letters of the plaintext, leftmost column defines letters from the
keyword. Ciphertext letter is taken from the cross of plaintext letter’s column and
keyword letter’s row, for example, plaintext value 2, if respective keyword letter is 3, will
be substituted by letter 0, taken from intersection of column 2 and row 3. This table may
be viewed as a function VT(p,k) of 2 arguments: plaintext letter p and keyword letter k,
value of which is entry of this table on the cross of column p and row k. We may write
out:
VT(p,k)=(p+k)modn
Where n is a number of different letters (in our example, n=5). When English
language is used, n=26. Let’s consider example from lecture (Lecture Notes, Slide 5;
Textbook, p.44):
Ciphertext: ANKYODKYUREPFJBYOJDSPLREYIUNOFDOIUERFPLUYTS
Key: mf u g p mi yd g axg ou f hkl l l mhs qd qo g t e wbqf q yov u h wt
Plaintext: mi s s s c ar l e t wi t h t he kn if e i n t he l ib r a r y
In this example, n=27 (with additional blank symbol) and 1st ciphertext symbol:
C1=A=0 =VT(m,m)=VT(12,12)=(12+12)mod 27=24=Y, so 1st letter is not valid, but
C1=A=0= VT(m,p)=VT(12,15)=(12+15)mod 27=0=A
Let’s consider 2nd symbol:
C2=N=13= VT(i,f)=VT(8,5)=(8+5)mod27=13=N
Similar, 3rd symbol:
C3=K=10=VT(s,u)=(20+18)mod27=38mod27=11=L, so 3rd letter is not valid, but
C3=K=10=VT(s,t)=(18+19)mod27=37mod27=10=K
Similar, 4th symbol
C4=Y=24=VT(s,g)=(18+6)mod27=24=Y.
So, first 4 letters of the key should be pftg instead of mfug.
6. Consider the following message:
SIDKHKDM AF HCRKIABIE SHIMC KD LFEAILA
The ciphertext was produced using the 1st sentence of The Other Side of Silence (a
book about the spy Kim Philby):
The snow lay thick on the steps and the snowflakes driven by the wind looked black
in the highlights of the cars.
A simple substitution cipher was used.
Decipher this message
basalisk to leviathan blake is contact
7. When the PT-109 American patrol boat, under the command of Lieutenant John
F. Kennedy, was sunk by a Japanese destroyer, a message was received in an Australian
wireless station in Playfair code:
KXJEY UREBE ZWEHE WRYTU HEYFS
KREHE GOYFI WTTTU OLKSY CAJPO
BOTEI ZONTX BYBWT GONEY CUZWR
GDSON SXBOU YWRHE BAAHY USEDQ
The key used was: