blob: b2afd0a69658c0d8c4f3c4b3f7dc233f779cddc6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
/*
* $Source$
* $Author$
*
* Copyright 1987, 1988, 1990 by the Massachusetts Institute of Technology.
*
* For copying and distribution information, please see the file
* <krb5/copyright.h>.
*
* This routine generates source code that implements the "E"
* operations of the DES.
*/
#include <krb5/copyright.h>
#include <krb5/krb5.h>
#include <stdio.h>
#include "des_int.h"
#include "tables.h"
void gen(stream)
FILE *stream;
{
register i;
/* clear the output */
fprintf(stream, " L2 = 0; R2 = 0;\n");
/* only take bits from R1, put into either L2 or R2 */
/* first setup E */
fprintf(stream, "/* E operations */\n/* right to left */\n");
/* first list mapping from left to left */
for (i = 0; i <= 31; i++)
if (E[i] < 32)
fprintf(stream,
" if (R1 & (1<<%2d)) L2 |= 1<<%2d;\n", E[i], i);
fprintf(stream, "\n/* now from right to right */\n");
/* list mapping from left to right */
for (i = 32; i <= 47; i++)
if (E[i] <32)
fprintf(stream, " if (R1 & (1<<%2d)) R2 |= 1<<%2d;\n",
E[i], i-32);
}
|