You are on page 1of 3

7/28/2016

SDESDecryptionsample

SDESDECRYPTIONSAMPLE
Theciphertextoutputproducedbytheencryptionsamplewas01000110.Wethereforeadoptthatasinputhere.Asacheck,weexpecttheoutputthatwill
emergeheretoproducetheencryptionsample'soriginalplaintextinput,whichwas01101101.
Asinputtothisdecryptionstage,useciphertextobtainedfrom
Input:
havingappliedSDEStosomeplaintext.Totheinput
0
1
(ciphertext),applyinitialpermutationIP:

IP
2

Inthenextsteps,wewilldevelop4bitswithwhichtoreplace
thelefthalfofthis"blue"result.
Toright4bitsofaboveresult,applyexpansion/permutation
E/P(generating8bitsfrom4).Thebitnumberingisthatofthe
4bitrightnibble,notofthe8bitbyte(e.g.,indicatedbit2
referstobyte'sbit6).
E/P
4

Uponaboveresult,performbinaryXORoperationwith
subkeyK2(whenencryptingweappliedK1firstthenK2
decryptingnow,wereversethatsequence):
K2
0

DeterminearowandacolumnfromaboveXORresult.For
therow,combinebits1and4andconverttodecimal.Forthe
column,combinebits2and3andconverttodecimal.
Determineanotherrowandcolumn.Forthissecondrow,
combinebits5and8forthissecondcolumn,bits6and7.
IdentifytheentryinsboxS0atthefirstrow/firstcolumnyou
determined.S0showsitindecimalconvertittobinary(two
bits).Enterthosebitsasthefirsthalfofthe4bitnumberat
right.IdentifytheentryinsboxS1atthesecondrow/second
columnyoudetermined.Convertittobinaryenterthosetwo
bitsasthesecondhalfofthenumberatright.

S0=

r0
r1
r2
r3

c0
1
3
0
3

c1
0
2
2
1

c2
3
1
1
3

c3
2
0
3
2

leftnibble:
bits1&4>10>2
bits2&3>10>2
therefore,getfromS0row2col2
resultis1>01
rightnibble:
bits1&4>01>1
bits2&3>00>0
therefore,getfromS1row1col0
resultis2>10

S1=

r0
r1
r2
r3

c0
0
2
3
2

c1
1
0
0
1

c2
2
1
1
0

c3
3
3
0
3

Toaboveresult,applypermutationP4:
P4
2
4
3

UpontheaboveP4result,performbinaryXORoperation,
XORwith1100
combiningitwiththeleft4bitsofourfirstresult(application
ofIPtooriginalciphertextinput,bluecellabove).
0
1
1
0
Wearetryingtoreplacethelefthalfofthatfirstresult.These
XORresultbitsarethereplacementbitsforit.
http://homepage.smc.edu/morgan_david/vpn/assignments/assgtsdesdecryptsample.htm

1/3

7/28/2016

SDESDecryptionsample

Rewritethat"blue"firstresultwithitslefthalfreplaced.(Look
itup,keep/copyitsrighthalf,usetheprecedingresultasthe
newlefthalf.)

Swapthetwo4bithalvesoftheabove(previous)result.
Inthenextsteps,wewillagaindevelop4replacementbits,
andwiththemreplacethelefthalfofthis"green"swapresult.
Thestepswillbethesameonesusedforthatpurposealready.
Toright4bitsofaboveswapresult,apply
expansion/permutationE/P(generating8bitsfrom4):

E/P
4

Uponaboveresult,performbinaryXORoperationwith
subkeyK1:
K1
1

Determinearowandacolumnfromaboveresult.Fortherow,
combinebits1and4andconverttodecimal.Forthecolumn,
combinebits2and3andconverttodecimal.
Determineanotherrowandcolumn.Forthissecondrow,
combinebits5and8forthissecondcolumn,bits6and7.
IdentifytheentryinsboxS0atthefirstrow/firstcolumnyou
determined.It'sgivenindecimalconvertittobinary(two
bits).Enterthosebitsasthefirsthalfofthe4bitnumberat
right.IdentifytheentryinsboxS1atthesecondrow/second
columnyoudetermined.Convertittobinaryenterthosetwo
bitsasthesecondhalfofthenumberatright.

S0=

r0
r1
r2
r3

c0
1
3
0
3

c1
0
2
2
1

c2
3
1
1
3

c3
2
0
3
2

leftnibble:
bits1&4>11>3
bits2&3>00>0
therefore,getfromS0row3col0
resultis3>11
rightnibble:
bits1&4>10>2
bits2&3>00>0
therefore,getfromS1row2col0
resultis3>11

S1=

r0
r1
r2
r3

c0
0
2
3
2

c1
1
0
0
1

c2
2
1
1
0

c3
3
3
0
3

Toaboveresult,applypermutationP4:
P4
2
4
3

UpontheaboveP4result,performbinaryXORoperation,
combiningitwiththeleft4bitsoftheearlierswapresult
(greencellabove).
Wearetryingtoreplacethelefthalfofthatswapresult.These
XORresultbitsarethereplacementbitsforit.
http://homepage.smc.edu/morgan_david/vpn/assignments/assgtsdesdecryptsample.htm

XORwith0001
1

0
2/3

7/28/2016

SDESDecryptionsample

Rewritethat"green"swapresultwithitslefthalfreplaced.
(Lookitup,keep/copyitsrighthalf,usetheprecedingresult
asthenewlefthalf.)

Toaboveresult,applyreverseofinitialpermutationIP,which
isIP1:

IP1
5
7

Thisresultisplaintext.ItistheSDESdecryptionofthe
ciphertextinput.Itshouldidenticallymatchtheoriginal
plaintext,fromwhichtheciphertextinputtothisprocesswas
firstderived.

Thisdecryptionoutputduplicatestheencryptioninput,sosatisfiesusthatprobablythealgorithmworksandourcalculationsaregood.

http://homepage.smc.edu/morgan_david/vpn/assignments/assgtsdesdecryptsample.htm

3/3

You might also like