2 * Copyright 1985, 1988 by the Massachusetts Institute of Technology.
4 * For copying and distribution information, please
5 * see the file <mit-cpyright.h>.
14 #include <mit-cpyright.h>
17 #include "des_internal.h"
18 #include "des_prototypes.h"
29 register afs_uint32 i, j, k, l, m, n;
31 /* rearrange the S table entries, and adjust for host bit order */
33 fprintf(stream, "static unsigned char const S_adj[8][64] = {");
34 fprintf(stream, " /* adjusted */\n");
36 for (i = 0; i <= 7; i++) {
37 for (j = 0; j <= 63; j++) {
39 * figure out which one to put in the new S[i][j]
41 * start by assuming the value of the input bits is "j" in
42 * host order, then figure out what it means in standard
45 k = swap_six_bits_to_ansi(j);
46 /* figure out the index for k */
47 l = (((k >> 5) & 01) << 5)
48 + ((k & 01) << 4) + ((k >> 1) & 0xf);
50 /* restore in host order */
51 n = swap_four_bits_to_ansi(m);
54 "i = %ld, j = %ld, k = %ld, l = %ld, m = %ld, n = %ld\n",
55 (long)i, (long)j, (long)k, (long)l, (long)m, (long)n);
60 for (i = 0; i <= 7; i++) {
61 fprintf(stream, "\n{ ");
63 for (j = 0; j <= 3; j++) {
64 fprintf(stream, "\n");
65 for (m = 0; m <= 15; m++) {
66 fprintf(stream, "%2d", temp[i][k]);
68 fprintf(stream, "\n}");
70 if ((k++ != 63) || (i != 7)) {
71 fprintf(stream, ", ");
77 fprintf(stream, "\n};\n");