You are on page 1of 4

Assignment #2

1. This problem provides a numerical example of encryption using a one-round version of


DES. We start with
Lo = 1100 1100 0000 0000 1100 1100 1111 1111
Ro = 1111 0000 1010 1010 1111 0000 1010 1010.

The first round key KI=OOOO 1011 0000001001100111 1001 1011 0100 1001 10100101.
Please calculate the following values.

(1) A=Ex[Ro] XOR KI.


(2) The output of S-boxes.

(3) LI and RI.

Hint: Ex[] is the expansion permutation. Use the tables referenced in the DES at

https:llen.wikipedia.org/wikiIDES supplementary material.

(1) Ex(Ro) = 01110 100001 010101 010101 011110 100001 010101 010101
A = 011100 010001 011100 11 00 10 111 000 010101 110011 110000
(2) B = 0000 110000100001 0110 1101 0101 0000
(3) PCB) = 1001 00100001 110000100000 1001 1100
RI = 0101 11100001 1100 1110 110001100011
L 1 = 1111 0000 10 10 1010 1111 0000 1010 1010

2. Given the plaintext {000102030405060708090AOBOCODOEOF} and the key


{01010101010101010101010101010101}:
a. Show the original contents of State, displayed as a 4 x 4 matrix.
b. Show the value of State after initial AddRoundKey.
c. Show the value of State after SubBytes.
d. Show the value of State after ShiftRows.
e. Show the value of State after MixColumns.

00 04 08 OC 01 05 09 OD 7C 6B 01 D7
01 05 09 OD 00 04 08 DC 63 F2 30 FE
02 06 OA OE 03 07 OB OF 7B C5 2B 76
03 07 OB OF 02 06 OA OE 77 6F 67 AB
a b c

~
7C 6B 01 D7 75 87 OF A2 ;;. 03, ~/, 0 '.J
F2 30 FE 63 55 E6 04 22 01 . 0). ·0 3. oj
2B 76 7B C5 3E 2E B8 Be PI 01 0)" 03
AB 77 6F 67 10 15 58 OA
d e
, of 0 I 02
3. (1) Define a toy hash function h: (Z2)7 ~ (Z2)4 by the rule by hex) =xA where all operations
are modulo 2 and

1 0 0 0
1 1 0 0
1 1 1 0
A= 1 1 1 1
0 1 1 1
0 0 1 1
0 0 0 1
Find all preimages of (0, 1,0,1).

(2) Suppose thatf: {O,l}m ~ {O,l}m is a preimage resistant bijection. Define h : {0, 1 }2m ~
{O,l}'" as follows. Given x E{O,l }2m, write x=x '\Ix", where x " x" E{O, l}m. Then define

h(x)=f(x' XOR x") . .


'XI ~ W~
<X)~6 t)
CX'4I
(pl)oof II)
to () I I I l 'O)
(0 I --V I t o I)
((9 I '0 I "1»)
C{ 0 '0 I " L I)
C( 0 J I l7 I 0)
(! l\)Q(9°I)
tl I ,. I
~ 0 1)

e;ba C~:
f
i& '(\

G/l1IMi 1)(;: 1)(' fi l It 0'() = (IK I &«")


0fk &~ rXl ~tKr . . ~ ~").:= 'X'@'X" tii'?<,·. ~ifJ... fer. $~l-) ::f( ifn'!)
i ~ IX,I!'Y>- ~ ~ ~ r~ of t'&l')
7~ h~ M>t ~ ri~ ~~toMt.
4. Suppose hi: {O, l }2m ~ {O,l}m is a collision resistant hash function.
(1) Define h2: {O,l }4m ~ {O , l}m as follows:
a. WritexE{O, l}4m asx=xlllx2, wherexI,x2 E{O, l}2m.
b. Define h2(X)=hl(hl(XI)llhl(X2».

Prove that h2 is collision resistant.

(2) For an integer i? 2, define a hash function h;: {O,1}2 m ~ {O,1}m recursively from hi-I, as
i

follows:
i i 1
a. Write x E{O,1}2 m as X=XtlIX2, where XI , X2E{O,1}2 - m.

b. Define hi(x)=hl(h i-I(XI)llh i-I(X2».

Prove that hi is collision resistant. I hPt

II). ~ -t:bn .6 IX (p1l'~I'''' ... h2- . -t >'I 'I I

<X:i.JX'.. 0AVi Al,(tX).::- h)(IX) ~ 'X~r 1{"Xl,. «~~, lftX2­

h 7. bI).:::h~(X') A, U\.\I ('XI)'f hi (X~.:: h,( h,(it)l{ h, ('X jJ)

=i)
St/wtQ h, ~ VJt{,'j/'1M nt&fJ~. hlctX,)// h,(1~:;' h,l'X/)II h, ('X;~

fll(:X,)~A( (IX') DWf hl(lX'1-)~ A, (Xzj)


5J~ Alu (,Qlf,'j'~ ~~. <x, ~rx,'; !X-;,?rx:, Wt,'J, ~~J.'ca:ft W1l1 «tx'
7~. h). ~ t.>l(i.sl\M ~~,
cH. ~ ~ ~ C>. atll>'~ em h~, it4 ~
,. ?(~I)( ', omr1 h~ cc<)'" h~to(') wh:~ ex::. ttl "1~. ~ IX,' (I%-'
hilt (X); k' ('i\") =? hdn~'-i(K')#hL'-f (IX v)/=-A( (h~ (IXc') (/hi'; ('X:J)
1"'Z'X~IIIIX~ 51'MJ. hi -i1 cJ,{t~,~ ~. 7~ h~-1 ('XI)~ h.'-t (IX,') ~M1 A.; -I ("i~)::! h~,-, c'X~)
?f1~?\III'XIl"
~ r..
h /
.4(X}=n~-fI(~,) , h J "

X'). -~U
Iv. IN
,u..,.,. ' ~ h (nC -.2 VX,,)1t A ~'-l. (tXt2» ::' AI( hi-2(1X,{jI/I"'-I (<</~) '.
I
.6- ')

~=-'J(~,I tx:' . hi'-I lx,) =- ni-t IK.) q tl Ai -~(rt,.,) 1/hn1'W =- Mk_ ~(~~) 1/A,e> (Pbl)
~l'hVL hJ~ toI/.'),.~ ~~~. 7/w,5.
hi-2 (~,I)=- A,-:l ('XI;) , At-viti,) =- h..-1-(lXI~). Jahi-iK'~-J~) ~ht-MlJr..:.)

517 ,p'~ Wt k .

hI(X'IIP··J -::h, (f'/';"'I ) I> hdXII"1JJ ;;A,(tX,(.,l.) 1kwxl-

5. (1) Use the extended Euclidean algoritlun to CDmpute the multiplicative inverses:
a. 17- 1 mod 101
b. 357- 1 mod 1234
(2) Compute gcd (57, 93), and find integers sand t such that 57s+93t= gcd (57, 93).
(c) Compute Euler's totient functions: cp(41), cp(27), and cp(440).

(1) , '7-1 fW1j~ (01.: b


r
~5 "..J113 ~ ..:: Is1
P). 8 c{ (!r1-?3):;~
C

s== --I ~ . t ~ ?

(J). rC<P()-==l/JO

f{~7):! res);t2.={Y

ttl(. b=- :z!X)o(l )

~(~~)~Jt'~/~ ~/bO

You might also like