Archive for June, 2008

Back from Vacationing

Site Maintenance | Posted by attriel June 28th, 2008

I had intended to get the next post in the DES Demonstrated series prepped and posted to show on Thursday, but had a few too many loose ends to wrap up at work before our vacation.

After the next post, I’ve got “repeat 16 times”, so those posts will probably go up one a day, which will still take 2-3 weeks since they are some LONG steps.

DES Key Manipulation K(1)

Crypts, Demonstration | Posted by attriel June 24th, 2008

Starting from K(0):

57 49 41 33 25 17 9
1 58 50 42 34 26 18
10 2 59 51 43 35 27
19 11 3 60 52 44 36

Using our translation table for C

57 49 41 33 25 17 9
1 58 50 42 34 26 18
10 2 59 51 43 35 27
19 11 3 60 52 44 36

We are left with C(0)

0 1 1 1 1 0 1
1 1 0 1 1 0 1
0 1 0 1 1 1 1
1 0 1 1 1 1 1

Translation D

63 55 47 39 31 23 15
7 62 54 46 38 30 22
14 6 61 53 45 37 29
21 13 5 28 20 12 4

1 0 0 0 1 1 1
0 1 1 0 0 1 1
0 0 1 0 0 0 1
1 0 0 0 1 1 1

Rotating C(0) to the left by 1 gives us C(1):

1 1 1 1 0 1 1
1 0 1 1 0 1 0
1 0 1 1 1 1 1
0 1 1 1 1 1 0

This simply moves the first bit to the end of the sequence. If the 4 lines are thought of as a single line, you take the first number and put it at the end, then break down into four lines again.

D(1), thusly, becomes

0 0 0 1 1 1 0
1 1 0 0 1 1 0
0 1 0 0 0 1 1
0 0 0 1 1 1 1

CD(1) is the merging of C(1) and D(1) (the 4 lines from C(1) followed by 4 more lines of D(1))

R 1 2 3 4 5 6 7
1 0 0 0 1 1 1 0
8 1 1 0 0 1 1 0
15 0 1 0 0 0 1 1
22 0 0 0 1 1 1 1
29 1 1 1 1 0 1 1
36 1 0 1 1 0 1 0
43 1 0 1 1 1 1 1
50 0 1 1 1 1 1 0

Using the K conversion table

14 17 11 24 1 5
3 28 15 6 21 10
23 19 12 4 26 8
16 7 27 20 13 2
41 52 31 37 47 55
30 40 51 45 33 48
44 49 39 56 34 53
46 42 50 36 29 32

We take the nth field from our CD(1) to define K(1)

0 0 0 0 0 1
0 1 0 1 1 0
0 0 1 1 1 1
1 0 1 1 1 0
1 1 1 0 1 1
1 0 1 1 0 1
0 1 1 0 1 1
1 0 0 1 1 1

DES Initial Permutation

Crypts, Demonstration | Posted by attriel June 19th, 2008

With our initial Block

R 1 2 3 4 5 6 7 8
1 0 1 0 0 0 1 0 0
9 0 1 0 0 0 1 0 1
17 0 1 0 0 0 0 0 1
25 0 1 0 0 0 1 0 0
33 0 1 0 0 0 0 1 0
41 0 1 0 0 0 1 0 1
49 0 1 0 0 0 1 0 1
57 0 1 0 0 0 1 1 0

Using the L(0) translation table

58 50 42 34 26 18 10 2
60 52 44 36 28 20 12 4
62 54 46 38 30 22 14 6
64 56 48 40 32 24 16 8

1 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0
1 1 1 0 1 0 1 1
0 1 1 0 0 1 1 0

The R translation Table:

57 49 41 33 25 17 9 1
59 51 43 35 27 19 11 3
61 53 45 37 29 21 13 5
63 55 47 39 31 23 15 7

The resulting R(0) is such:

0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
1 0 0 1 0 0 0 0

DES: Pre-setup

Crypts, Demonstration | Posted by attriel June 17th, 2008

For the purposes of this exercise, we’re going to use the following information:

Data: ‘DEADBEEF’

0 1 0 0 0 1 0 0
0 1 0 0 0 1 0 1
0 1 0 0 0 0 0 1
0 1 0 0 0 1 0 0
0 1 0 0 0 0 1 0
0 1 0 0 0 1 0 1
0 1 0 0 0 1 0 1
0 1 0 0 0 1 1 0

This is our initial 64-bit datablock

Key:0xDEADBEEF313371, layed out vertically

1 1 1 1 0 0 0 0
1 0 0 1 0 0 1 1
0 1 1 1 1 1 1 1
1 0 1 0 1 1 1 1
1 1 1 1 0 0 0 0
1 1 1 1 0 0 0 0
1 0 1 1 0 1 0 0
0 1 0 1 1 1 1 1

This gives us our 64-bit Key block, and every row has an even number of 1′s and 0′s, utilizing the 8th-bit of each word for parity.

DES Overview

Crypts, Descriptions | Posted by attriel June 13th, 2008

Many people would have put this first, I realize.  Actually, had I thought of it, I might have too.

But I also think it makes a great deal of sense now.  Because now I can link the bits to their posts.  WHEE!

Setup (Initial Permutation)
Do 16x:

Process Key (Key Manipulations)
Process L & R with K through f (Main Algorithm)

Done
Finish (Final Permutation)

FINI

The demonstrated versions are going to be HUGE!  And start Tuesday!

DES: Final Permutation

Crypts, Descriptions | Posted by attriel June 10th, 2008

After 16 cycles are complete, we take the L(16) and R(16), catenate them, and use the following Final Permutation to generate our encrypted 64-bit data block

40 8 48 16 56 24 64 32
39 7 47 15 55 23 63 31
38 6 46 14 54 22 62 30
37 5 45 13 53 21 61 29
36 4 44 12 52 20 60 28
35 3 43 11 51 19 59 27
34 2 42 10 50 18 58 26
33 1 41 9 49 17 57 25

DES: Main Algorithm

Crypts, Descriptions | Posted by attriel June 5th, 2008

Given the initial L(0) and R(0), we then develop L(1) and R(1)

L(i+1) = R(i)
R(i+1) = L XOR f(R(i),K(i+1))

For function f, R(i) is expanded from 32-bit to 48-bit R’(i)

32 1 2 3 4 5
4 5 6 7 8 9
8 9 10 11 12 13
12 13 14 15 16 17
16 17 18 19 20 21
20 21 22 23 24 25
24 25 26 27 28 29
28 29 30 31 32 1

R’(i) XOR K(i+1) (RK(i))is then broken into 8 6-bit chunks and permuted through S tables. (See S-Table post)

This permutation is then FURTHER permuted, which gives us the result (F(i)) of f(R(i),K(i+1))

16 7 20 21
29 12 28 17
1 15 23 26
5 18 31 10
2 8 24 14
32 27 3 9
19 13 30 6
22 11 4 25

F(i) is then XOR’d with L(i) (from WAAAY back), giving us the R(i+1).

DES: S-Tables

Crypts, Descriptions | Posted by attriel June 4th, 2008

The 6-bits from RK(i) are then further mixed RK(i,0)RK(i,5) and RK(i,1..4), which provides a 4-bit response

The first and last bits define which ROW, and the middle 4-bits define the COLUMN

S(1)

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

00

01

10

11

Full listings after the break

Read the rest of this entry »