1 The hunt for getting a DES with plain BSD license w/o advertisement clause
2 ==========================================================================
6 This all feels very silly given that DES is about 30 years old and now
9 Helpful documents on the way:
11 Schider's crypto wasn't that useful since it only told how to do DES,
12 not how to do des fast or how to not use DES. I find this to be a
13 common thread in the book, it explain each tool in great detail, but
16 Dag Arne Osvik: Efficient Implementation of the Data Encryption Standard
18 Some threads on sci.crypto was also useful.
24 Getting the PC1 bit mangling working was hard, I never got it to work.
26 Printning out the bit usage made me realize a lookup table could be
27 used since only 12 bits are used from the first half and 16 from the
30 01110000 01110000 01110000 01110000 01111000 01111000 01111000 01111000
31 00001111 00001111 00001111 00001111 00000111 00000111 00000111 00000111
33 The pattern is getting more obvious if it's printed out where the bits
54 Only 3 bits-table is needed for the first half and 4 bits for the
55 second half because they are on diffrent shift offsets.
57 So to get the bitpattern bit-pattern
59 gen_pattern("pc1_c_3", 7, [ 5, 13, 21 ], 0, 0x1000000);
60 gen_pattern("pc1_c_4", 15, [ 1, 9, 17, 25 ], 0, 0x1000000);
61 gen_pattern("pc1_d_3", 7, [ 49, 41, 33 ], 32, 0x1000000);
62 gen_pattern("pc1_d_4", 15, [ 57, 53, 45, 37 ], 32, 0x1000000);
67 PC2 is also a table lookup, since it's a 24 bit field, I use 4 6-bit
68 lookup tables. Printing the reverse of the PC2 table reveal that some
69 of the bits are not used, namely (9, 18, 22, 25) from c and (7, 10,
88 So we generate tables for that too.
90 gen_pattern("pc2_c_1", 63, [ 5, 24, 7, 16, 6, 10 ], 0, 0x800000);
91 gen_pattern("pc2_c_2", 63, [ 20, 18, 12, 3, 15, 23 ], 0, 0x800000);
92 gen_pattern("pc2_c_3", 63, [ 1, 9, 19, 2, 14, 22 ], 0, 0x800000);
93 gen_pattern("pc2_c_4", 63, [ 11, 13, 4, 17, 21, 8 ], 0, 0x800000);
95 gen_pattern("pc2_d_1", 63, [ 51, 35, 31, 52, 39, 45 ], 28, 0x800000);
96 gen_pattern("pc2_d_2", 63, [ 50, 32, 43, 36, 29, 48 ], 28, 0x800000);
97 gen_pattern("pc2_d_3", 63, [ 41, 38, 47, 33, 40, 42 ], 28, 0x800000);
98 gen_pattern("pc2_d_4", 63, [ 49, 37, 30, 46, 34, 44 ], 28, 0x800000);
104 The SBOX transformations are 6 bit to 4 bit transformations.
106 Here I grew tired and used Richard Outerbridge SBOXes. Thank you