Home 0P3N Blog DES (Data Encryption Standard)
Ready to Start Your Career?
Create Free Account
HamzaMegahed s profile image
By: HamzaMegahed
January 26, 2016

DES (Data Encryption Standard)

By: HamzaMegahed
January 26, 2016
HamzaMegahed s profile image
By: HamzaMegahed
January 26, 2016
DES (Data Encryption Standard) - CybraryDES (Data Encryption Standard)DES:DES adopted in 1977 by (NIST) National Institute of Slandered and Technology).With DES, data are encrypted in 64 bit blocks, with a key length 56 bits and with output ciphertext 64 bits. DES has the exact structure of Feistel Cipher, but without Initial Permutation (IP) and Inverse Initial Permutation IP1. Key Generator Algorithm:The key generator passes through many steps to produce subkeys.
1- The key generator algorithm takes 64 bits key as input. The input key number table from 1 to 64 is as follows:
2- Every eighth bit is ignored and produces 56 bits.
3- 56 bits pass through a permutation Choice one (PC-1) and displays as follows:
4- The output is separated into two 28 bits C and D. The he first 28 bits are called  C0 (left part) and the last 28 bits are called D0.5- At each round, a circular left shift is preformed on  Ci1 and  Di1 by 1 or 2 bits. See the table below:
6- Then Ci1 and  Di1 in each round, passes through permutation choice two (PC-2) to produce 48 bits.
7- The permutation Choice Two output in each round is uses as input to the encryption algorithm. Encryption Algorithm:There are two inputs to the encryption algorithm: 1- Plaintext 64 bits 2- Encryption key 48 bits.The encryption algorithm also passes through many steps to produce a ciphertext. See the figure below:
1- The plaintext block 64 bits pass through an initial permutation (IP) that the rearranged bits and produces the permuted input. Initial Permutation:A- Initial Permutation takes the plaintext as input. The table consists of 64 bits numbered from 1 to 64:
B- Then the initial permutation will be permuted input as 64 bits:
C- The Inverse Initial Permutation is:
2- The permuted input block split into two halves each is 32 bits. The first 32 bits are called L and the last 32 bits are called R.Now, The F function will start the rest of all the steps.3- Expand R 32 bits to 48 bits to fit the subkey by preforming the Expansion permutation (E):
4- Preform Exclusive-OR between the subkey and Expansion Permutation (E) on R.E(Ri-1)⊕ Ki.5- The result of E(Ri-1)⊕ Ki pass through a substitution function and produce 32 bits output. Substitution Function:
Substitution Function is rolled by S-Box. S-Box consists of 8 boxes, each of which accepts 6 bits as input and produces 4 bits output:A- Break the result of E(Ri-1)⊕ Ki into 8 blocks, each containing 6 bits. These blocks are numbered from 1 to 8.B- Each block will perform a substitution with S-Box with the same number:
A- The first and the last bits of each block together as 2 bit value indicate the number of rows in the same number S-Box.B- The middle four bits of each block together as-bit value, indicating the number of columns in the same number S-Box.C- The decimal value, which is selected by the row and the column convert to-bit value in all S-Boxes. For Example:Suppose the first 6 bits of the result of E(Ri-1)⊕ Ki = 010101.So, the input to S1 = 010101.The row value = 0 1 = 1 (decimal).The column value = 1010 = 10 (decimal).The decimal value will be 12 = 1100 (4-bit value).D- Combine results of each S-Box together 32 bits.6- The result of the substitution operation (output of S-Boxes) passes through a Permutation Function (P).
At this point, the function F is finished.7- Perform Exclusive-OR between the output of the Permutation Function(P) and Li1. Then, put the result in Ri , and put Ri1 inLi.The overall formulas for DES Encryption Algorithm:Li = Ri1.Ri = Li1 ⊕ F(Ri1,Ki).8- Perform a 32-bit swap on the result of the final round. Then, perform Inverse Initial Permutation (IP1) on the swapped data to produces the ciphertext 64 bits. Decryption Algorithm:The inputs to decryption algorithm are ciphertext and subkey Ki but in reverse order, start with Kn then K(n1) and so on until K1 in the last round.Note: You can use a DES Calculator https://github.com/Hamza-Megahed/des-calculator to study each round in detail.
Schedule Demo

Build your Cybersecurity or IT Career

Accelerate in your role, earn new certifications, and develop cutting-edge skills using the fastest growing catalog in the industry