0% found this document useful (0 votes)
52 views22 pages

DES Example

Uploaded by

bcs07183008
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views22 pages

DES Example

Uploaded by

bcs07183008
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 22

DES (Data Encryption Standard)

Data Encryption Standard (DES)


• A block cipher processes plaintext input in fixed-sized blocks
and produces a block of ciphertext of equal size for each
plaintext block.
• Data Encryption Standard (DES) was issued in 1977 as Federal
Information Processing Standard 46 (FIPS 46) by the National
Institute of Standards and Technology (NIST).

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:

Let M be the plain text message M = 0123456789ABCDEF


M = 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110
1111
L = 0000 0001 0010 0011 0100 0101 0110 0111
R = 1000 1001 1010 1011 1100 1101 1110 1111

Let K be the hexadecimal key K = 133457799BBCDFF1


K = 00010011 00110100 01010111 01111001 10011011 10111100 11011111 11110001
Example: From the original 64-bit key
K = 00010011 00110100 01010111 01111001 10011011 10111100 11011111 11110001
we get the 56-bit permutation
K+ = 1111000 0110011 0010101 0101111 0101010 1011001 1001111 0001111
K+ = 1111000 0110011 0010101 0101111 0101010 1011001 1001111 0001111

C0 = 1111000 0110011 0010101 0101111


D0 = 0101010 1011001 1001111 0001111
From original pair C0 and D0 we obtain:
For the first key we have
C1D1 = 1110000 1100110 0101010 1011111 1010101 0110011 0011110 0011110
which, after we apply the permutation PC-2, becomes
K1 = 000110 110000 001011 101111 111111 000111 000001 110010
For the other keys we have
K2 = 011110 011010 111011 011001 110110 111100 100111 100101
K3 = 010101 011111 110010 001010 010000 101100 111110 011001
K4 = 011100 101010 110111 010110 110110 110011 010100 011101
K5 = 011111 001110 110000 000111 111010 110101 001110 101000
K6 = 011000 111010 010100 111110 010100 000111 101100 101111
K7 = 111011 001000 010010 110111 111101 100001 100010 111100
K8 = 111101 111000 101000 111010 110000 010011 101111 111011
K9 = 111000 001101 101111 101011 111011 011110 011110 000001
K10 =101100 011111 001101 000111 101110 100100 011001 001111
K11 =001000 010101 111111 010011 110111 101101 001110 000110
K12 =011101 010111 000111 110101 100101 000110 011111 101001
K13 =100101 111100 010111 010001 111110 101011 101001 000001
K14 =010111 110100 001110 110111 111100 101110 011100 111010
K15 =101111 111001 000110 001101 001111 010011 111100 001010
K16 =110010 110011 110110 001011 000011 100001 011111 110101
Encryption:
M (4 x 16 bits)  IP L0Ro (4 x 16 bits)
Ln = Rn-1
Rn = Ln-1 + f(Rn-1,Kn) {1<=n<=16}
R0 (4 x 8 bits)  E(R0) (from E Bit-Selection Table) (6 x 8 bits)
Calculate: K1+E(R0) (6 x 8 bits)  B1B2B3B4B5B6B7B8
Applying respective S-Boxes
S1(B1)S2(B2)S3(B3)S4(B4)S5(B5)S6(B6)S7(B7)S8(B8) (4 x 8 bits)
From P table
f = P(S1(B1)S2(B2)...S8(B8)) (4 x 8 bits)
Calculate R1 = L0 + f(R0 , K1 ) Till 16 rounds calculate LnRn (e.g. L16R16)
At the end of 16th round:
L16R16  R16L16  Ciphertext (IP-1) (8 x 8 bits)
Applying the initial permutation to the block of text M, given previously, we get

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

From IP, we get L0 and R0


L0 = 1100 1100 0000 0000 1100 1100 1111 1111
R0 = 1111 0000 1010 1010 1111 0000 1010 1010
Ln = Rn-1
Rn = Ln-1 + f(Rn-1,Kn)

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)

For K1 , E(R0), we have

K1 = 000110 110000 001011 101111 111111 000111 000001 110010


E(R0) = 011110 100001 010101 010101 011110 100001 010101 010101
K1+E(R0) = 011000 010001 011110 111010 100001 100110 010100 100111

Write the previous result, which is 48 bits, in the form:


Kn + E(Rn-1) =B1B2B3B4B5B6B7B8,

where each Bi is a group of six bits. We now calculate


S1(B1)S2(B2)S3(B3)S4(B4)S5(B5)S6(B6)S7(B7)S8(B8)
B1 = 0 1 1 0 1 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:

K1 + E(R0) = 011000 010001 011110 111010 100001 100110 010100 100111

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 )

= 1100 1100 0000 0000 1100 1100 1111 1111


+ 0010 0011 0100 1010 1010 1001 1011 1011
= 1110 1111 0100 1010 0110 0101 0100 0100
In the next round, we will have L2 = R1, which is the block we just calculated, and then we
must calculate R2 =L1 + f(R1, K2)

If we process all 16 blocks using the method defined


previously, we get, on the 16th round,

L16 = 0100 0011 0100 0010 0011 0010 0011 0100


R16 = 0000 1010 0100 1100 1101 1001 1001 0101

R16L16 = 00001010 01001100 11011001 10010101 01000011 01000010 00110010 00110100


IP-1 = 10000101 11101000 00010011 01010100 00001111 00001010 10110100 00000101
which in hexadecimal format is 85E813540F0AB405

This is the encrypted form of


M = 0123456789ABCDEF, C = 85E813540F0AB405

You might also like