Vous êtes sur la page 1sur 17

DATA ENCRYPTION STANDARD (DES)

by Engr. Khurram Hashmi

Sequence

Cryptography Block Ciphers DES


Encryption Algorithm

Feistel

Function Pseudo Code

Cryptography

Block Ciphers

Block of plain Text Size: (M)

Cipher Encryption Algorithm

Block of cipher Text Size : (M)

Secret key

Data Encryption Standard

It is a block Cipher
plain Text 64 bit blocks N Blocks Cipher Encryption Algorithm 16 cycles Cipher Text 64 bit blocks N Blocks

Secret key 64 bits

56 bits used

Data is encrypted block by block i.e. 64 bits each time

Block Division
Divides the Data into N blocks of 64 bit length
Block _size = 64 bit Assuming that each location in an array stores 1 bit Input>> input_data [any length ]
Loop: (count bits: 0 to data end) Initialize: N=0, until all data stored { Loop: (count bits: 0 to 63), initialize: i=0, until : i=63 { Input_data_block N [ i ]= Input_ data[ i ] Increment : i } Increment: N a number of blocks }

128 bit

64 bit

64 bit

Encryption Algorithm

32bit 32bit

32bit 32bit

Data is processed as 32 bit half-blocks Takes 16 rounds to complete In each round, a new subkey from the key scheduler is utilized Data is swapped after each round except the last Initial and final permutations are Inverses of each other

48 bit Subkey 48 bit Subkey

XOR

Encryption Algorithm-Splitting Half


Input _data_block[64 bits] << Input Loop: (counts 32bits) { Half_block_1 [32bits] <<- -first 32bits : Input_data_block [ 64 bits] } Loop: (counts 32bits) { }
32 bit 32 bit 64 bit block

Half_block_2 [32bits] <<- -next 32bits : Input_data_block [ 64 bits]

Encryption Algorithm

Initial Permutation

Loop:( counts :16 rounds) {

Fiestel Function executed with Inputs:


Half_block_1 [32 bits] Subkey_N [48 bits]

Cipher_text[32 bit] = Fiestel_output [32 bit]

Half_block_2 [32bits]

Such that output is swapped each time before next round except the last round Final Permutation

Output >> Cipher_text [64 bits]

Initial and Final permutations are inverses of each other

Feistel function

Expansion 48 bit data XOR The S-Boxes Non Linear Transformation 4-bit output Enables Swap 6-bit input

32 bit Data Output

Feistel function

Expansion:
Loop(until data expansion is complete) { halfblock_expnaded[48 bits] << EXPANSION<<half_block_N [32 bits] }

Key Mixing:
Array [48 bits ] << halfblock_expanded [48 bits] subkey [48 bits]
4 bit 1 bit Original data Expansion 6 bits 6 bits 6 bits 6 bits ... 6 bits

1 bit

Expanded Data 48 bits

Feistel function

Input to S-boxes:
the input for each s-box can be stored in a separate array of 6 locations Loop: (counts 8 cycles) { Loop : (counts 6 bits: 0 to 5) Initialize: i=0, until i=5 {
S input S input2 S input 8

% thereby accounting for the 48 bits: 6*8=48


Array [48 bit]

S-box_input_N [i] = array [i]

increment: i
} }

Feistel function

Substitution (S-Boxes):

Feistal_output [32 bit array] %will store the output of the s-boxes Loop: (counts : 8 cycles) %the eight boxes { Loop: (counts 4 bits) %Each box gives output of 4 bits { Look_up_table : non linear transformation executed S-box_input_N [i] > transformed > SN- box output [4 bit] Feistal_output [ i ] << SN- box output [4 bit] %output being stored } Feistel_output [32 bit] } So a 32 bit output is obtained S output i.e. Feistal_output [32 bit array]
S1 S2

S8

Look up table
Non Linear Transformation
Middle 4 bits of input
S5 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 00 0010 1100 0100 0001 0111 1010 1011 0110 1000 0101 0011 1111 1101 0000 1110 1001

Outer bits

01
10 11

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

Input: 011011

Output: 1001

Feistel function
Output Permutation:

Such that in the next round a Swap occurs Loop: ( ) { Output fixed Permutation on Feistel_output [32 bit] }

Output >> Feistel_output [32 bit array]

Encryption
Cipher Encryption Algorithm 16 cycles

plain Text 64 bit blocks N Blocks

Cipher Text 64 bit blocks N Blocks

Secret key 64 bits

56 bits used

And Decryption is Similar. . .

Thank You
Questions

Vous aimerez peut-être aussi