GolfScript (175 chars)
I assume input and output in MSB-first upper-case hex.
For want of good test cases, I don't guarantee that this implementation is correct. I've worked to a test case which I derived from Rivest's simple test for implementations of DES: given his test input of 9474B8E8C73BCA7D
I think that the expected output is
BE23F4265E76
63FD57CA5952
6DEDC3C5E33C
73E5BBF11EC8
FD8593D8923F
778A9F177EAC
3FB0963839F1
3E0CFEA3E837
41FFD1A34BCB
55FDE796B313
F3E5C3F70764
79C7A758ABCA
F1919F74F41D
3582F76B34EA
B758B6ACF92B
44FF4B3F4D29
To that caveat I must add another, which is that I use a lot of base conversion including some of strings with non-printable characters. As usual, I'll give the program in a couple of ASCII-safe formats. xxd output:
0000000: 312f 7b31 302c 2727 2a37 312c 3635 3e2b 1/{10,''*71,65>+
0000010: 3a5e 5c3f 3136 2b32 7b62 6173 657d 3a42 :^\?16+2{base}:B
0000020: 7e28 3b7e 7d25 607b 3d7d 2b5b 3536 5b5b ~(;~}%`{=}+[56[[
0000030: 2d38 5d32 342a 372f 2e2b 2739 3939 1b37 -8]24*7/.+'999.7
0000040: 3717 275d 7a69 705b 5d2a 5b5d 2a7b 3124 7.']zip[]*[]*{1$
0000050: 2b7d 2f5d 2534 3932 3831 2032 427b 2129 +}/]%49281 2B{!)
0000060: 7b32 382f 7b28 2b7d 257e 2b7d 2a27 1d3c {28/{(+}%~+}*'.<
0000070: f9df 2a9b 7079 2030 dea2 83df 3bca a82f ..*.py 0....;../
0000080: 50ec 11f8 e55c 74d2 f104 b2ae 130e ac5c P....\t........\
0000090: d627 27ff 3827 7b42 7d2f 7b31 243d 7d25 .''.8'{B}/{1$=}%
00000a0: 342f 7b32 425e 3d7d 256e 2b5c 7d2f 3b 4/{2B^=}%n+\}/;
Base-64 encoded:
MS97MTAsJycqNzEsNjU+KzpeXD8xNisye2Jhc2V9OkJ+KDt+fSVgez19K1s1NltbLThdMjQqNy8u
Kyc5OTkbNzcXJ116aXBbXSpbXSp7MSQrfS9dJTQ5MjgxIDJCeyEpezI4L3soK30lfit9KicdPPnf
KptweSAw3qKD3zvKqC9Q7BH45Vx00vEEsq4TDqxc1icn/zgne0J9L3sxJD19JTQvezJCXj19JW4r
XH0vOw==
And with the magic strings substituted with a printable (but longer) version using escape characters and some unnecessary line-breaks:
1/{10,''*71,65>+:^\?16+2{base}:B~(;~}%`{=}+
[56[[-8]24*7/.+'999\e77\027']zip[]*[]*{1$+}/]
%49281 2B{!){28/{(+}%~+}*
'\035<\371\337*\233py 0\336\242\203\337;\312\250/P\354\021\370\345\\t\322\361\004\262\256\023\016\254\\\326'
'\3778'{B}/{1$=}%4/{2B^=}%n+\}/;
This is a pretty literal translation. The vaguely interesting bits are:
- Permutation PC1 turns out to have a lot of structure. If you take first differences, all but 6 of them are
-8
. The second line of the reformatted version reconstructs it from these differences in 39 characters. For comparison, representing it by base conversion would require 44 characters for the string literal; and representing a generic permutation of numbers 1 to 63 requires 36 base-256 digits (i.e. a 38-character string literal plus code to convert it).
49281 2B{!) ... }
encodes the shift lengths. This is the most obvious place to attempt further optimisation.
- Permutation PC2 doesn't seem to have any usable structure, so that's a straight double base conversion. (Not to be confused with a double bass conversion).