You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

d3des.c 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  1. /*
  2. * This is D3DES (V5.09) by Richard Outerbridge with the double and
  3. * triple-length support removed for use in VNC. Also the bytebit[] array
  4. * has been reversed so that the most significant bit in each byte of the
  5. * key is ignored, not the least significant.
  6. *
  7. * These changes are:
  8. * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
  9. *
  10. * This software is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. */
  14. /* D3DES (V5.09) -
  15. *
  16. * A portable, public domain, version of the Data Encryption Standard.
  17. *
  18. * Written with Symantec's THINK (Lightspeed) C by Richard Outerbridge.
  19. * Thanks to: Dan Hoey for his excellent Initial and Inverse permutation
  20. * code; Jim Gillogly & Phil Karn for the DES key schedule code; Dennis
  21. * Ferguson, Eric Young and Dana How for comparing notes; and Ray Lau,
  22. * for humouring me on.
  23. *
  24. * Copyright (c) 1988,1989,1990,1991,1992 by Richard Outerbridge.
  25. * (GEnie : OUTER; CIS : [71755,204]) Graven Imagery, 1992.
  26. */
  27. #include "d3des.h"
  28. static void scrunch(unsigned char *, unsigned long *);
  29. static void unscrun(unsigned long *, unsigned char *);
  30. static void desfunc(unsigned long *, unsigned long *);
  31. static void cookey(unsigned long *);
  32. static unsigned long KnL[32] = { 0L };
  33. static unsigned short bytebit[8] = {
  34. 01, 02, 04, 010, 020, 040, 0100, 0200 };
  35. static unsigned long bigbyte[24] = {
  36. 0x800000L, 0x400000L, 0x200000L, 0x100000L,
  37. 0x80000L, 0x40000L, 0x20000L, 0x10000L,
  38. 0x8000L, 0x4000L, 0x2000L, 0x1000L,
  39. 0x800L, 0x400L, 0x200L, 0x100L,
  40. 0x80L, 0x40L, 0x20L, 0x10L,
  41. 0x8L, 0x4L, 0x2L, 0x1L };
  42. /* Use the key schedule specified in the Standard (ANSI X3.92-1981). */
  43. static unsigned char pc1[56] = {
  44. 56, 48, 40, 32, 24, 16, 8, 0, 57, 49, 41, 33, 25, 17,
  45. 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35,
  46. 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21,
  47. 13, 5, 60, 52, 44, 36, 28, 20, 12, 4, 27, 19, 11, 3 };
  48. static unsigned char totrot[16] = {
  49. 1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28 };
  50. static unsigned char pc2[48] = {
  51. 13, 16, 10, 23, 0, 4, 2, 27, 14, 5, 20, 9,
  52. 22, 18, 11, 3, 25, 7, 15, 6, 26, 19, 12, 1,
  53. 40, 51, 30, 36, 46, 54, 29, 39, 50, 44, 32, 47,
  54. 43, 48, 38, 55, 33, 52, 45, 41, 49, 35, 28, 31 };
  55. void deskey(key, edf) /* Thanks to James Gillogly & Phil Karn! */
  56. unsigned char *key;
  57. int edf;
  58. {
  59. register int i, j, l, m, n;
  60. unsigned char pc1m[56], pcr[56];
  61. unsigned long kn[32];
  62. for ( j = 0; j < 56; j++ ) {
  63. l = pc1[j];
  64. m = l & 07;
  65. pc1m[j] = (key[l >> 3] & bytebit[m]) ? 1 : 0;
  66. }
  67. for( i = 0; i < 16; i++ ) {
  68. if( edf == DE1 ) m = (15 - i) << 1;
  69. else m = i << 1;
  70. n = m + 1;
  71. kn[m] = kn[n] = 0L;
  72. for( j = 0; j < 28; j++ ) {
  73. l = j + totrot[i];
  74. if( l < 28 ) pcr[j] = pc1m[l];
  75. else pcr[j] = pc1m[l - 28];
  76. }
  77. for( j = 28; j < 56; j++ ) {
  78. l = j + totrot[i];
  79. if( l < 56 ) pcr[j] = pc1m[l];
  80. else pcr[j] = pc1m[l - 28];
  81. }
  82. for( j = 0; j < 24; j++ ) {
  83. if( pcr[pc2[j]] ) kn[m] |= bigbyte[j];
  84. if( pcr[pc2[j+24]] ) kn[n] |= bigbyte[j];
  85. }
  86. }
  87. cookey(kn);
  88. return;
  89. }
  90. static void cookey(raw1)
  91. register unsigned long *raw1;
  92. {
  93. register unsigned long *cook, *raw0;
  94. unsigned long dough[32];
  95. register int i;
  96. cook = dough;
  97. for( i = 0; i < 16; i++, raw1++ ) {
  98. raw0 = raw1++;
  99. *cook = (*raw0 & 0x00fc0000L) << 6;
  100. *cook |= (*raw0 & 0x00000fc0L) << 10;
  101. *cook |= (*raw1 & 0x00fc0000L) >> 10;
  102. *cook++ |= (*raw1 & 0x00000fc0L) >> 6;
  103. *cook = (*raw0 & 0x0003f000L) << 12;
  104. *cook |= (*raw0 & 0x0000003fL) << 16;
  105. *cook |= (*raw1 & 0x0003f000L) >> 4;
  106. *cook++ |= (*raw1 & 0x0000003fL);
  107. }
  108. usekey(dough);
  109. return;
  110. }
  111. void cpkey(into)
  112. register unsigned long *into;
  113. {
  114. register unsigned long *from, *endp;
  115. from = KnL, endp = &KnL[32];
  116. while( from < endp ) *into++ = *from++;
  117. return;
  118. }
  119. void usekey(from)
  120. register unsigned long *from;
  121. {
  122. register unsigned long *to, *endp;
  123. to = KnL, endp = &KnL[32];
  124. while( to < endp ) *to++ = *from++;
  125. return;
  126. }
  127. void des(inblock, outblock)
  128. unsigned char *inblock, *outblock;
  129. {
  130. unsigned long work[2];
  131. scrunch(inblock, work);
  132. desfunc(work, KnL);
  133. unscrun(work, outblock);
  134. return;
  135. }
  136. static void scrunch(outof, into)
  137. register unsigned char *outof;
  138. register unsigned long *into;
  139. {
  140. *into = (*outof++ & 0xffL) << 24;
  141. *into |= (*outof++ & 0xffL) << 16;
  142. *into |= (*outof++ & 0xffL) << 8;
  143. *into++ |= (*outof++ & 0xffL);
  144. *into = (*outof++ & 0xffL) << 24;
  145. *into |= (*outof++ & 0xffL) << 16;
  146. *into |= (*outof++ & 0xffL) << 8;
  147. *into |= (*outof & 0xffL);
  148. return;
  149. }
  150. static void unscrun(outof, into)
  151. register unsigned long *outof;
  152. register unsigned char *into;
  153. {
  154. *into++ = (unsigned char)((*outof >> 24) & 0xffL);
  155. *into++ = (unsigned char)((*outof >> 16) & 0xffL);
  156. *into++ = (unsigned char)((*outof >> 8) & 0xffL);
  157. *into++ = (unsigned char)(*outof++ & 0xffL);
  158. *into++ = (unsigned char)((*outof >> 24) & 0xffL);
  159. *into++ = (unsigned char)((*outof >> 16) & 0xffL);
  160. *into++ = (unsigned char)((*outof >> 8) & 0xffL);
  161. *into = (unsigned char)(*outof & 0xffL);
  162. return;
  163. }
  164. static unsigned long SP1[64] = {
  165. 0x01010400L, 0x00000000L, 0x00010000L, 0x01010404L,
  166. 0x01010004L, 0x00010404L, 0x00000004L, 0x00010000L,
  167. 0x00000400L, 0x01010400L, 0x01010404L, 0x00000400L,
  168. 0x01000404L, 0x01010004L, 0x01000000L, 0x00000004L,
  169. 0x00000404L, 0x01000400L, 0x01000400L, 0x00010400L,
  170. 0x00010400L, 0x01010000L, 0x01010000L, 0x01000404L,
  171. 0x00010004L, 0x01000004L, 0x01000004L, 0x00010004L,
  172. 0x00000000L, 0x00000404L, 0x00010404L, 0x01000000L,
  173. 0x00010000L, 0x01010404L, 0x00000004L, 0x01010000L,
  174. 0x01010400L, 0x01000000L, 0x01000000L, 0x00000400L,
  175. 0x01010004L, 0x00010000L, 0x00010400L, 0x01000004L,
  176. 0x00000400L, 0x00000004L, 0x01000404L, 0x00010404L,
  177. 0x01010404L, 0x00010004L, 0x01010000L, 0x01000404L,
  178. 0x01000004L, 0x00000404L, 0x00010404L, 0x01010400L,
  179. 0x00000404L, 0x01000400L, 0x01000400L, 0x00000000L,
  180. 0x00010004L, 0x00010400L, 0x00000000L, 0x01010004L };
  181. static unsigned long SP2[64] = {
  182. 0x80108020L, 0x80008000L, 0x00008000L, 0x00108020L,
  183. 0x00100000L, 0x00000020L, 0x80100020L, 0x80008020L,
  184. 0x80000020L, 0x80108020L, 0x80108000L, 0x80000000L,
  185. 0x80008000L, 0x00100000L, 0x00000020L, 0x80100020L,
  186. 0x00108000L, 0x00100020L, 0x80008020L, 0x00000000L,
  187. 0x80000000L, 0x00008000L, 0x00108020L, 0x80100000L,
  188. 0x00100020L, 0x80000020L, 0x00000000L, 0x00108000L,
  189. 0x00008020L, 0x80108000L, 0x80100000L, 0x00008020L,
  190. 0x00000000L, 0x00108020L, 0x80100020L, 0x00100000L,
  191. 0x80008020L, 0x80100000L, 0x80108000L, 0x00008000L,
  192. 0x80100000L, 0x80008000L, 0x00000020L, 0x80108020L,
  193. 0x00108020L, 0x00000020L, 0x00008000L, 0x80000000L,
  194. 0x00008020L, 0x80108000L, 0x00100000L, 0x80000020L,
  195. 0x00100020L, 0x80008020L, 0x80000020L, 0x00100020L,
  196. 0x00108000L, 0x00000000L, 0x80008000L, 0x00008020L,
  197. 0x80000000L, 0x80100020L, 0x80108020L, 0x00108000L };
  198. static unsigned long SP3[64] = {
  199. 0x00000208L, 0x08020200L, 0x00000000L, 0x08020008L,
  200. 0x08000200L, 0x00000000L, 0x00020208L, 0x08000200L,
  201. 0x00020008L, 0x08000008L, 0x08000008L, 0x00020000L,
  202. 0x08020208L, 0x00020008L, 0x08020000L, 0x00000208L,
  203. 0x08000000L, 0x00000008L, 0x08020200L, 0x00000200L,
  204. 0x00020200L, 0x08020000L, 0x08020008L, 0x00020208L,
  205. 0x08000208L, 0x00020200L, 0x00020000L, 0x08000208L,
  206. 0x00000008L, 0x08020208L, 0x00000200L, 0x08000000L,
  207. 0x08020200L, 0x08000000L, 0x00020008L, 0x00000208L,
  208. 0x00020000L, 0x08020200L, 0x08000200L, 0x00000000L,
  209. 0x00000200L, 0x00020008L, 0x08020208L, 0x08000200L,
  210. 0x08000008L, 0x00000200L, 0x00000000L, 0x08020008L,
  211. 0x08000208L, 0x00020000L, 0x08000000L, 0x08020208L,
  212. 0x00000008L, 0x00020208L, 0x00020200L, 0x08000008L,
  213. 0x08020000L, 0x08000208L, 0x00000208L, 0x08020000L,
  214. 0x00020208L, 0x00000008L, 0x08020008L, 0x00020200L };
  215. static unsigned long SP4[64] = {
  216. 0x00802001L, 0x00002081L, 0x00002081L, 0x00000080L,
  217. 0x00802080L, 0x00800081L, 0x00800001L, 0x00002001L,
  218. 0x00000000L, 0x00802000L, 0x00802000L, 0x00802081L,
  219. 0x00000081L, 0x00000000L, 0x00800080L, 0x00800001L,
  220. 0x00000001L, 0x00002000L, 0x00800000L, 0x00802001L,
  221. 0x00000080L, 0x00800000L, 0x00002001L, 0x00002080L,
  222. 0x00800081L, 0x00000001L, 0x00002080L, 0x00800080L,
  223. 0x00002000L, 0x00802080L, 0x00802081L, 0x00000081L,
  224. 0x00800080L, 0x00800001L, 0x00802000L, 0x00802081L,
  225. 0x00000081L, 0x00000000L, 0x00000000L, 0x00802000L,
  226. 0x00002080L, 0x00800080L, 0x00800081L, 0x00000001L,
  227. 0x00802001L, 0x00002081L, 0x00002081L, 0x00000080L,
  228. 0x00802081L, 0x00000081L, 0x00000001L, 0x00002000L,
  229. 0x00800001L, 0x00002001L, 0x00802080L, 0x00800081L,
  230. 0x00002001L, 0x00002080L, 0x00800000L, 0x00802001L,
  231. 0x00000080L, 0x00800000L, 0x00002000L, 0x00802080L };
  232. static unsigned long SP5[64] = {
  233. 0x00000100L, 0x02080100L, 0x02080000L, 0x42000100L,
  234. 0x00080000L, 0x00000100L, 0x40000000L, 0x02080000L,
  235. 0x40080100L, 0x00080000L, 0x02000100L, 0x40080100L,
  236. 0x42000100L, 0x42080000L, 0x00080100L, 0x40000000L,
  237. 0x02000000L, 0x40080000L, 0x40080000L, 0x00000000L,
  238. 0x40000100L, 0x42080100L, 0x42080100L, 0x02000100L,
  239. 0x42080000L, 0x40000100L, 0x00000000L, 0x42000000L,
  240. 0x02080100L, 0x02000000L, 0x42000000L, 0x00080100L,
  241. 0x00080000L, 0x42000100L, 0x00000100L, 0x02000000L,
  242. 0x40000000L, 0x02080000L, 0x42000100L, 0x40080100L,
  243. 0x02000100L, 0x40000000L, 0x42080000L, 0x02080100L,
  244. 0x40080100L, 0x00000100L, 0x02000000L, 0x42080000L,
  245. 0x42080100L, 0x00080100L, 0x42000000L, 0x42080100L,
  246. 0x02080000L, 0x00000000L, 0x40080000L, 0x42000000L,
  247. 0x00080100L, 0x02000100L, 0x40000100L, 0x00080000L,
  248. 0x00000000L, 0x40080000L, 0x02080100L, 0x40000100L };
  249. static unsigned long SP6[64] = {
  250. 0x20000010L, 0x20400000L, 0x00004000L, 0x20404010L,
  251. 0x20400000L, 0x00000010L, 0x20404010L, 0x00400000L,
  252. 0x20004000L, 0x00404010L, 0x00400000L, 0x20000010L,
  253. 0x00400010L, 0x20004000L, 0x20000000L, 0x00004010L,
  254. 0x00000000L, 0x00400010L, 0x20004010L, 0x00004000L,
  255. 0x00404000L, 0x20004010L, 0x00000010L, 0x20400010L,
  256. 0x20400010L, 0x00000000L, 0x00404010L, 0x20404000L,
  257. 0x00004010L, 0x00404000L, 0x20404000L, 0x20000000L,
  258. 0x20004000L, 0x00000010L, 0x20400010L, 0x00404000L,
  259. 0x20404010L, 0x00400000L, 0x00004010L, 0x20000010L,
  260. 0x00400000L, 0x20004000L, 0x20000000L, 0x00004010L,
  261. 0x20000010L, 0x20404010L, 0x00404000L, 0x20400000L,
  262. 0x00404010L, 0x20404000L, 0x00000000L, 0x20400010L,
  263. 0x00000010L, 0x00004000L, 0x20400000L, 0x00404010L,
  264. 0x00004000L, 0x00400010L, 0x20004010L, 0x00000000L,
  265. 0x20404000L, 0x20000000L, 0x00400010L, 0x20004010L };
  266. static unsigned long SP7[64] = {
  267. 0x00200000L, 0x04200002L, 0x04000802L, 0x00000000L,
  268. 0x00000800L, 0x04000802L, 0x00200802L, 0x04200800L,
  269. 0x04200802L, 0x00200000L, 0x00000000L, 0x04000002L,
  270. 0x00000002L, 0x04000000L, 0x04200002L, 0x00000802L,
  271. 0x04000800L, 0x00200802L, 0x00200002L, 0x04000800L,
  272. 0x04000002L, 0x04200000L, 0x04200800L, 0x00200002L,
  273. 0x04200000L, 0x00000800L, 0x00000802L, 0x04200802L,
  274. 0x00200800L, 0x00000002L, 0x04000000L, 0x00200800L,
  275. 0x04000000L, 0x00200800L, 0x00200000L, 0x04000802L,
  276. 0x04000802L, 0x04200002L, 0x04200002L, 0x00000002L,
  277. 0x00200002L, 0x04000000L, 0x04000800L, 0x00200000L,
  278. 0x04200800L, 0x00000802L, 0x00200802L, 0x04200800L,
  279. 0x00000802L, 0x04000002L, 0x04200802L, 0x04200000L,
  280. 0x00200800L, 0x00000000L, 0x00000002L, 0x04200802L,
  281. 0x00000000L, 0x00200802L, 0x04200000L, 0x00000800L,
  282. 0x04000002L, 0x04000800L, 0x00000800L, 0x00200002L };
  283. static unsigned long SP8[64] = {
  284. 0x10001040L, 0x00001000L, 0x00040000L, 0x10041040L,
  285. 0x10000000L, 0x10001040L, 0x00000040L, 0x10000000L,
  286. 0x00040040L, 0x10040000L, 0x10041040L, 0x00041000L,
  287. 0x10041000L, 0x00041040L, 0x00001000L, 0x00000040L,
  288. 0x10040000L, 0x10000040L, 0x10001000L, 0x00001040L,
  289. 0x00041000L, 0x00040040L, 0x10040040L, 0x10041000L,
  290. 0x00001040L, 0x00000000L, 0x00000000L, 0x10040040L,
  291. 0x10000040L, 0x10001000L, 0x00041040L, 0x00040000L,
  292. 0x00041040L, 0x00040000L, 0x10041000L, 0x00001000L,
  293. 0x00000040L, 0x10040040L, 0x00001000L, 0x00041040L,
  294. 0x10001000L, 0x00000040L, 0x10000040L, 0x10040000L,
  295. 0x10040040L, 0x10000000L, 0x00040000L, 0x10001040L,
  296. 0x00000000L, 0x10041040L, 0x00040040L, 0x10000040L,
  297. 0x10040000L, 0x10001000L, 0x10001040L, 0x00000000L,
  298. 0x10041040L, 0x00041000L, 0x00041000L, 0x00001040L,
  299. 0x00001040L, 0x00040040L, 0x10000000L, 0x10041000L };
  300. static void desfunc(block, keys)
  301. register unsigned long *block, *keys;
  302. {
  303. register unsigned long fval, work, right, leftt;
  304. register int round;
  305. leftt = block[0];
  306. right = block[1];
  307. work = ((leftt >> 4) ^ right) & 0x0f0f0f0fL;
  308. right ^= work;
  309. leftt ^= (work << 4);
  310. work = ((leftt >> 16) ^ right) & 0x0000ffffL;
  311. right ^= work;
  312. leftt ^= (work << 16);
  313. work = ((right >> 2) ^ leftt) & 0x33333333L;
  314. leftt ^= work;
  315. right ^= (work << 2);
  316. work = ((right >> 8) ^ leftt) & 0x00ff00ffL;
  317. leftt ^= work;
  318. right ^= (work << 8);
  319. right = ((right << 1) | ((right >> 31) & 1L)) & 0xffffffffL;
  320. work = (leftt ^ right) & 0xaaaaaaaaL;
  321. leftt ^= work;
  322. right ^= work;
  323. leftt = ((leftt << 1) | ((leftt >> 31) & 1L)) & 0xffffffffL;
  324. for( round = 0; round < 8; round++ ) {
  325. work = (right << 28) | (right >> 4);
  326. work ^= *keys++;
  327. fval = SP7[ work & 0x3fL];
  328. fval |= SP5[(work >> 8) & 0x3fL];
  329. fval |= SP3[(work >> 16) & 0x3fL];
  330. fval |= SP1[(work >> 24) & 0x3fL];
  331. work = right ^ *keys++;
  332. fval |= SP8[ work & 0x3fL];
  333. fval |= SP6[(work >> 8) & 0x3fL];
  334. fval |= SP4[(work >> 16) & 0x3fL];
  335. fval |= SP2[(work >> 24) & 0x3fL];
  336. leftt ^= fval;
  337. work = (leftt << 28) | (leftt >> 4);
  338. work ^= *keys++;
  339. fval = SP7[ work & 0x3fL];
  340. fval |= SP5[(work >> 8) & 0x3fL];
  341. fval |= SP3[(work >> 16) & 0x3fL];
  342. fval |= SP1[(work >> 24) & 0x3fL];
  343. work = leftt ^ *keys++;
  344. fval |= SP8[ work & 0x3fL];
  345. fval |= SP6[(work >> 8) & 0x3fL];
  346. fval |= SP4[(work >> 16) & 0x3fL];
  347. fval |= SP2[(work >> 24) & 0x3fL];
  348. right ^= fval;
  349. }
  350. right = (right << 31) | (right >> 1);
  351. work = (leftt ^ right) & 0xaaaaaaaaL;
  352. leftt ^= work;
  353. right ^= work;
  354. leftt = (leftt << 31) | (leftt >> 1);
  355. work = ((leftt >> 8) ^ right) & 0x00ff00ffL;
  356. right ^= work;
  357. leftt ^= (work << 8);
  358. work = ((leftt >> 2) ^ right) & 0x33333333L;
  359. right ^= work;
  360. leftt ^= (work << 2);
  361. work = ((right >> 16) ^ leftt) & 0x0000ffffL;
  362. leftt ^= work;
  363. right ^= (work << 16);
  364. work = ((right >> 4) ^ leftt) & 0x0f0f0f0fL;
  365. leftt ^= work;
  366. right ^= (work << 4);
  367. *block++ = right;
  368. *block = leftt;
  369. return;
  370. }
  371. /* Validation sets:
  372. *
  373. * Single-length key, single-length plaintext -
  374. * Key : 0123 4567 89ab cdef
  375. * Plain : 0123 4567 89ab cde7
  376. * Cipher : c957 4425 6a5e d31d
  377. *
  378. * Double-length key, single-length plaintext -
  379. * Key : 0123 4567 89ab cdef fedc ba98 7654 3210
  380. * Plain : 0123 4567 89ab cde7
  381. * Cipher : 7f1d 0a77 826b 8aff
  382. *
  383. * Double-length key, double-length plaintext -
  384. * Key : 0123 4567 89ab cdef fedc ba98 7654 3210
  385. * Plain : 0123 4567 89ab cdef 0123 4567 89ab cdff
  386. * Cipher : 27a0 8440 406a df60 278f 47cf 42d6 15d7
  387. *
  388. * Triple-length key, single-length plaintext -
  389. * Key : 0123 4567 89ab cdef fedc ba98 7654 3210 89ab cdef 0123 4567
  390. * Plain : 0123 4567 89ab cde7
  391. * Cipher : de0b 7c06 ae5e 0ed5
  392. *
  393. * Triple-length key, double-length plaintext -
  394. * Key : 0123 4567 89ab cdef fedc ba98 7654 3210 89ab cdef 0123 4567
  395. * Plain : 0123 4567 89ab cdef 0123 4567 89ab cdff
  396. * Cipher : ad0d 1b30 ac17 cf07 0ed1 1c63 81e4 4de5
  397. *
  398. * d3des V5.0a rwo 9208.07 18:44 Graven Imagery
  399. **********************************************************************/