98..Etc/Security2008. 7. 24. 11:47
반응형

DES ( data encryption standard ) is a symetric encryption.

 This means that the encryption and decryption is done with the same key.

permutations

Permutations are just bit pattern replacements.
Here are the 10 bit permutations.
premutation old pattern new pattern
p10 9876543210 7583609124
p8 9876543210 47362501
p4 3210 2013
ip 76543210 62574031
ip_inv 76543210 47531602
ep 3210 03212103
sw 76543210 32107654

functions

Des has two functions fk and F. These are shown graphically below.

f_k(L,R,SK) = ( L ^ F(R,SK),R )

s-boxes

These are simple two dimensional arrays of values.

We use data at runtime to determine what row and column to get. ex :

 static const uval S0[4][4] = 
{ { 1, 0, 3, 2 }, { 3, 2, 1, 0 }, { 0, 2, 1, 3 }, { 3, 1, 0, 3 } };  

simple DES

I am doing simple DES ( S-DES or 10 bit DES ).

I am working on 8 bit data blocks, with a 10 bit key. ( click on the images for larger versions )

Here is how generating subkeys works.
Here is how encryption works.

Here is how f_k works. The function F,

 is embedded inside this

simple.c simple DES source code

real DES

The above example is S-DES, which is a scaled down version of DES. DES usually has a 56-bit key, and 16 48-bit subkeys are generated. It works on 64-bit input blocks. F acts on 32 bits not 4. The s-boxes are 4 by 16, not 4 by 4 ( using the first and last bit for row ).

The images were created using Graphviz

 

 

 

#include<stdio.h> #include<stdlib.h>  /*    Simple DES    I am implimenting what is called 
Posted by 1010