DES Example
DES Example
2
Data Encryption Standard (DES)
DES Encryption
• Data are encrypted in 64-bit blocks using a 56-bit key.
• The algorithm transforms 64-bit input in a series of steps into
a 64-bit output.
• There are two inputs to the encryption function: the plaintext
to be encrypted and the key.
• The function expects a 64-bit key out of which only 56 are
used; other 8 bits can be set arbitrarily
3
Data Encryption Standard (DES)
• Plaintext proceeds in three phases.
• First, the 64-bit plaintext passes through an initial
permutation (IP) that rearranges the bits to produce the
permuted input.
• The 2nd phase consists of 16 rounds of the same function,
which involves both permutation and substitution functions.
• The output of the last round consists of 64 bits that are a
function of the input plaintext and the key.
• The left and right halves of the output are swapped to
produce preoutput.
• Finally, the preoutput is passed through a permutation that
is the inverse of the initial permutation function, to produce
the 64-bit ciphertext. 4
DES (Data Encryption Standard)
DES involves into 2 major steps
• Subkey Generation
• Encryption
Subkey Generation
• Given (M, K)
• M L, R
• K K+ (from PC-1 Table) (56-bits) C0D0 upto C16D16 (from left shift
table) (28 bits each)
• Respective CnDn pairs {1<=n<=16} Kn (from PC-2 table) (6 x 8 bits)
• Note: Grouping K into 8 8-bits groups, the last bit of each group remain unused.
Example:
M = 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
IP = 1100 1100 0000 0000 1100 1100 1111 1111 1111 0000 1010 1010 1111 0000 1010 1010
For n = 1, we have
K1 = 000110 110000 001011 101111 111111 000111 000001 110010
L1 = R0 = 1111 0000 1010 1010 1111 0000 1010 1010
R1 = L0 + f(R0,K1)
We calculate E(R0) from R0 as follows:
R0 = 1111 0000 1010 1010 1111 0000 1010 1010
E(R0) = 011110 100001 010101 010101 011110 100001 010101 010101
Next in the f calcualtion, we XOR the output E(Rn-1) with the key Kn:
Kn + E(Rn-1)
Kn + E(Rn-1)
01 1st Row
1101 13th column No.
5 0101
S1(B1) = 0101 (4 bit)
For the first round, we obtain as the output of the eight S boxes:
S1(B1)S2(B2)S3(B3)S4(B4)S5(B5)S6(B6)S7(B7)S8(B8)
= 0101 1100 1000 0010 1011 0101 1001 0111
f = P(S1(B1)S2(B2)...S8(B8))
From the output of the eight S boxes:
S1(B1)S2(B2)S3(B3)S4(B4)S5(B5)S6(B6)S7(B7)S8(B8)
= 0101 1100 1000 0010 1011 0101 1001 0111
we get
f = 0010 0011 0100 1010 1010 1001 1011 1011
R1 = L0 + f(R0 , K1 )