2 * Copyright 1987, 1988 by the Massachusetts Institute of Technology.
4 * For copying and distribution information, please see the file
7 * This routine generates source code implementing the initial
8 * permutation of the DES.
11 #include <mit-cpyright.h>
13 #include "des_internal.h"
16 extern afs_int32 swap_bit_pos_0();
17 extern afs_int32 rev_swap_bit_pos_0();
19 #define SWAP(x) swap_long_bytes_bit_number(swap_bit_pos_0_to_ansi(x))
26 /* clear the output */
27 fprintf(stream," L2 = 0; R2 = 0;\n");
30 fprintf(stream,"/* IP operations */\n/* first left to left */\n");
32 /* first list mapping from left to left */
33 for (i = 0; i <= 31; i++)
35 test_set(stream, "L1", SWAP(IP[i]), "L2", i);
37 /* now mapping from right to left */
38 fprintf(stream,"\n/* now from right to left */\n");
39 for (i = 0; i <= 31; i++)
41 test_set(stream, "R1", SWAP(IP[i]-32), "L2", i);
43 fprintf(stream,"\n/* now from left to right */\n");
44 /* list mapping from left to right */
45 for (i = 32; i <= 63; i++)
47 test_set(stream, "L1", SWAP(IP[i]), "R2", i-32);
49 /* now mapping from right to right */
50 fprintf(stream,"\n/* last from right to right */\n");
51 for (i = 32; i <= 63; i++)
53 test_set(stream, "R1", SWAP(IP[i]-32), "R2", i-32);