0% found this document useful (0 votes)
88 views

DES Example

1) The document describes the process of encrypting a plain text message using the Data Encryption Standard (DES) algorithm. 2) DES takes a 64-bit block of plaintext and uses a 56-bit key to encrypt the block into ciphertext via 16 rounds of encryption using 48-bit subkeys generated from the original key. 3) Each round consists of an expansion function, XOR with the subkey, S-box lookups, and output to generate a 32-bit value to XOR with the next block to produce the ciphertext.

Uploaded by

Ahmed Hesham
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPS, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
88 views

DES Example

1) The document describes the process of encrypting a plain text message using the Data Encryption Standard (DES) algorithm. 2) DES takes a 64-bit block of plaintext and uses a 56-bit key to encrypt the block into ciphertext via 16 rounds of encryption using 48-bit subkeys generated from the original key. 3) Each round consists of an expansion function, XOR with the subkey, S-box lookups, and output to generate a 32-bit value to XOR with the next block to produce the ciphertext.

Uploaded by

Ahmed Hesham
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPS, PDF, TXT or read online on Scribd
You are on page 1/ 15

DES example

Example: Let M be the plain text message M = 0123456789ABCDEF, where


M is in hexadecimal (base 16) format. Rewriting M in binary format, we get
the 64-bit block of text

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. This gives us as the
binary key (setting 1 = 0001, 3 = 0011, etc., and grouping together every eight
bits, of which the last one in each group will be unused):

K = 00010011 00110100 01010111 01111001 10011011 10111100 11011111 11110001


Step 1: Create 16 subkeys, each of which is 48-bits long.

K = 00010011 00110100 01010111 01111001 10011011 10111100 11011111 11110001

K+ = 1111000 0110011 0010101 0101111 0101010 1011001 1001111 0001111


Next, split this key into left and right halves, LK and RK, where each half has 28
bits.

Example: From the permuted key K+, we get


LK0 = 1111000 0110011 0010101 0101111
RK0 = 0101010 1011001 1001111 0001111

LK0 = 1111000011001100101010101111
RK0 = 0101010101100110011110001111

LK1 = 1110000110011001010101011111
RK1 = 1010101011001100111100011110

LK2 = 1100001100110010101010111111
RK2 = 0101010110011001111000111101

LK3 = 0000110011001010101011111111
RK3 = 0101011001100111100011110101
We now form the keys Kn, for 1<=n<=16, by applying the following permutation
table to each of the concatenated pairs LKnRKn. Each pair has 56 bits, but PC-2
only uses 48 of these.

Example: For the first key we have


LP1RP1 = 1110000 1100110 0101010 1011111 1010101 0110011 0011110 0011110

K1 = 000110 110000 001011 101111 111111 000111 000001 110010


Step 2: Encode each 64-bit block of data.

There is an initial permutation IP of the 64 bits of the message data M. This


rearranges the bits according to the following table, where the entries in the
table show the new arrangement of the bits from their initial order. The 58th bit
of M becomes the first bit of IP. The 50th bit of M becomes the second bit of
IP. The 7th bit of M is the last bit of IP.

Example: 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
Example: 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

Example: 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)
E (xpansion) BIT-SELECTION TABLE

Example: 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 calculation, we XOR the output E(Rn-1) with the key Kn:
Kn + E(Rn-1).

Example: 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,

S1(B1)S2(B2)S3(B3)S4(B4)S5(B5)S6(B6)S7(B7)S8(B8)
where Si(Bi) refers to the output of the i-th S-box.
f = P(S1(B1)S2(B2)S3(B3)S4(B4)S5(B5)S6(B6)S7(B7)S8(B8) )
Example: 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), and so on for 16 rounds. At the
end of the sixteenth round we have the blocks L 16 and R16. We then reverse
the order of the two blocks into the 64-bit block =
1110 1111 0100 1010 0110 0101 0100 0100

R16L16

and apply a final permutation IP-1 as defined by the following table:


Example: 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

We reverse the order of these two blocks and apply the final permutation to

R16L16 = 00001010 01001100 11011001 10010101 01000011 01000010 00110010


00110100

IP-1 = 10000101 11101000 00010011 01010100 00001111 00001010 10110100


00000101

This is the encrypted form of M = 0123456789ABCDEF: namely, C =


85E813540F0AB405.

You might also like