Solution: DES Algorithm, S-Boxes, and Key Generation Explained

Verified

Added on  2023/01/19

|7
|1460
|97
Homework Assignment
AI Summary
This document presents a detailed solution to a Data Encryption Standard (DES) algorithm assignment. It begins by illustrating the S-box lookup process with examples, showing how the input plaintext and key values are used to determine the S-box output. The solution then outlines the DES algorithm's core components, including the initial permutation, the mixer function, the swapper function, and the function itself. The mixer function's interaction with the left and right blocks and round keys is explained. The function's internal workings, including expansion permutation, XOR operations, substitution using S-boxes, and straight permutation, are also described. Additionally, the key generation process, involving key shifts and compression, is addressed. The solution includes code snippets for shift operations and provides a comprehensive understanding of each step in the DES algorithm.
tabler-icon-diamond-filled.svg

Contribute Materials

Your contribution can guide someone’s learning journey. Share your documents today.
Document Page
DES
Solution
S-Box-1
S-Box-2
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 12 01 08 14 06 11 03 04 09 07 02 13 12 00 05 10
1 03 13 04 07 15 02 08 14 12 00 01 10 06 09 11 05
2 00 14 07 11 10 04 13 01 05 08 12 06 09 03 02 15
3 13 08 10 01 03 15 04 12 11 06 07 12 00 05 14 09
S-Box-3
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 10 00 09 14 06 03 15 05 01 13 12 07 11 04 02 08
1 13 07 00 09 03 04 06 10 02 08 05 14 012 11 15 01
2 13 06 04 09 08 15 03 00 11 01 02 12 05 10 14 07
3 01 10 13 00 06 09 08 07 04 15 14 03 11 05 02 12
S-Box-4
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 07 13 14 03 00 06 09 10 1 02 08 05 11 12 04 15
1 13 08 11 05 06 15 00 03 04 07 02 12 01 10 14 09
2 10 06 09 00 12 11 07 13 15 01 03 14 05 02 08 04
3 03 15 00 06 10 01 13 08 09 04 05 11 12 07 02 14
S-Box-5
tabler-icon-diamond-filled.svg

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 02 12 04 01 07 10 11 06 08 05 03 15 13 00 14 09
1 14 11 02 12 04 07 13 01 05 00 15 10 03 09 08 06
2 04 02 01 11 10 13 07 08 15 09 12 05 06 03 00 14
3 11 08 12 07 01 14 02 13 06 15 00 09 10 04 05 03
S-Box-6
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 12 01 10 15 09 02 06 08 00 13 03 04 14 07 05 11
1 10 15 04 02 07 12 09 05 06 01 13 14 00 11 03 08
2 09 14 15 05 02 08 12 03 07 00 04 10 01 13 11 06
3 04 03 02 12 09 05 15 10 11 14 01 07 10 00 08 13
S-Box-7
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 4 11 2 14 15 00 08 13 03 12 09 07 05 10 06 01
1 13 00 11 07 04 09 01 10 14 03 05 12 02 15 08 06
2 01 04 11 13 12 03 07 14 10 15 06 08 00 05 09 02
3 06 11 13 08 01 04 10 07 09 05 00 15 14 02 03 12
Document Page
S-Box-8
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 13 02 08 04 06 15 11 01 10 09 03 14 05 00 12 07
1 01 15 13 08 10 03 07 04 12 05 06 11 10 14 09 02
2 07 11 04 01 09 12 14 02 00 06 10 10 15 03 05 08
3 02 01 14 07 04 10 08 13 15 12 09 09 03 05 06 11
PlainText (5CB7)
Key=(101011 011100 110011 101110)
Key(101011)
The first and sixth bites together (101011),we get 11 in binary and that decimal value is
3.
Remaining values is 0101 in binary and that decimal value is 2.So look the row 3,column 2 in
table s-box-1.The results is 8 and that binary value is 1000.So the input 101011 for plaintext
5 yields the output 1000.
Key(011100)
The first and sixth bites together (011100),we get 00 in binary and that decimal value is
0.
Remaining values is 1110 in binary and that decimal value is 3.So look the row 0,column 3 in
table s-box-8.The results is 2 and that binary value is 0010.So the input 011100 for plaintext
12 yields the output 0010.
Key(110011)
The first and sixth bites together (110011),we get 11 in binary and that decimal value is
3.
Remaining values is 1001 in binary and that decimal value is 2.So look the row 3,column 2 in
table s-box-1.The results is 8 and that binary value is 1000.So the input 110011 for plaintext
11 yields the output 1000.
Document Page
Key(101110)
The first and sixth bites together (101110),we get 10 in binary and that decimal value is
2.
Remaining values is 0111 in binary and that decimal value is 3.So look the row 2,column 3 in
table s-box-2.The results is 11 and that binary value is 1011.So the input 101110 for plaintext
7 yields the output 1011.
DES Algorithm
Cipher(plainBlock[64],RoundKeys[16,48],cipherBlock[64])
{
permute(64,64,plainBlock,inBlock,InitialPermutation Table)
split(64,32,inBlock,leftBlock,rightBlock)
for(round=1 to 16)
{
mixer(leftBlock,rightBlock,RoundKeys[round])
if(round!=16)swapper (leftBlock,rightBlock)
}
combine?(32,64,leftBlock,rightBlock,outBlock)
permute(64,64,outBlock,cipherBlock,FinaPermutationTable)
}
mixer(leftBlock[48]rightBlock[48],RoundKey[48])
{
copy(32,rightBlock,T1)
function?(T1,Roundkey,T2)
exclusiveOr(32,lefetBlock,T2,T4)
copy(32,T4,rightBlock)
}
swapper (leftBlock[32],right[32])
{
copy(32,leftBlock,T)
tabler-icon-diamond-filled.svg

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
copy(32,rightBlock,leftBlock)
copy(32,T,rightBlock)
}
function(inBlock[32],Roundkey[48],outBlock[32])
{
permute(#2,48,inBlock,T1,ExpansionPermutationTable)
exclusiveOr(48,T1,RoundKey,T2)
substitute(T2,T3,Substitute Tables)
permute(32,32,T4,outBlock,StraightPermutationTable)
}
substitute(inBlock[32],outBlock[48],SubstitutionTables[5,12,11,7]
{
for(i=1 to 5)
{
row<- 1 x inBlock[i x 5+1] + inBlock[i x 5 +5]
col<-5 xinBlock[i x5+2]+4 x inBlock[i x 5 +3]+
2 x inBlock[i x 5 +4]
value=Substitution Tables[i][row][col]
outBlock[[i x 4 +1]<- value/5; value mod 5
outBlock[[i x 4 +2]<- value/3; value mod 3
outBlock[[i x 4 +3]<- value/1; value mod 1
outBlock[[i x 4 +4]<- value
}
for(round=1 to 16)
{
shiftLeft(leftKey,ShiftTable[round])
shiftLeft(rightKey,ShiftTable[round])
combine(12,11,leftKey,rightKey,preRoundKey)
permute(11,7,preRoundKey,RoundKeys[round],KeyCompressionTable)
}
}
shiftLeft(block[12],numOfShifts)
Document Page
{
for(i=1 to numOfShifts)
{
T<--block[1]
for(j=2 to 12)
{
block[j-1<--block[j]
}
block[12<-T
}
shiftRight(block[11],numOfShifts)
{
for(i=1 to numOfShifts)
{
T<--block[1]
for(j=2 to 11)
{
block[j-1]<--block[j]
}
block[11]<-T
}
ShiftLeft(block[7],numOfShifts)
{
for(i=1 to numOfShifts)
{
T<--block[1]
for(j=2 to 7)
{
block[j-]1<--block[j]
}
block[7]<-T
}
}
Document Page
chevron_up_icon
1 out of 7
circle_padding
hide_on_mobile
zoom_out_icon
logo.png

Your All-in-One AI-Powered Toolkit for Academic Success.

Available 24*7 on WhatsApp / Email

[object Object]