Select Git revision
-
Fredrik Hübinette (Hubbe) authored
Rev: src/block_alloc.h:1.16 Rev: src/builtin_functions.c:1.245 Rev: src/dmalloc.h:1.20 Rev: src/dynamic_buffer.h:1.7 Rev: src/error.c:1.42 Rev: src/object.c:1.94 Rev: src/pike_memory.c:1.55 Rev: src/pike_types.h:1.38 Rev: src/stralloc.c:1.80 Rev: src/stralloc.h:1.41 Rev: src/svalue.c:1.63 Rev: src/svalue.h:1.48
Fredrik Hübinette (Hubbe) authoredRev: src/block_alloc.h:1.16 Rev: src/builtin_functions.c:1.245 Rev: src/dmalloc.h:1.20 Rev: src/dynamic_buffer.h:1.7 Rev: src/error.c:1.42 Rev: src/object.c:1.94 Rev: src/pike_memory.c:1.55 Rev: src/pike_types.h:1.38 Rev: src/stralloc.c:1.80 Rev: src/stralloc.h:1.41 Rev: src/svalue.c:1.63 Rev: src/svalue.h:1.48
desdata.c 4.43 KiB
/* desdata.c
*
* Generate tables used by des.c and desCode.h.
*
* $Id$ */
/*
* des - fast & portable DES encryption & decryption.
* Copyright (C) 1992 Dana L. How
* Please see the file `descore.README' for the complete copyright notice.
*
*/
#if HAVE_CONFIG_H
# include "config.h"
#endif
#include "desinfo.h"
#include "desCode.h"
/* list of weak and semi-weak keys
+0 +1 +2 +3 +4 +5 +6 +7
0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
0x01 0x1f 0x01 0x1f 0x01 0x0e 0x01 0x0e
0x01 0xe0 0x01 0xe0 0x01 0xf1 0x01 0xf1
0x01 0xfe 0x01 0xfe 0x01 0xfe 0x01 0xfe
0x1f 0x01 0x1f 0x01 0x0e 0x01 0x0e 0x01
0x1f 0x1f 0x1f 0x1f 0x0e 0x0e 0x0e 0x0e
0x1f 0xe0 0x1f 0xe0 0x0e 0xf1 0x0e 0xf1
0x1f 0xfe 0x1f 0xfe 0x0e 0xfe 0x0e 0xfe
0xe0 0x01 0xe0 0x01 0xf1 0x01 0xf1 0x01
0xe0 0x1f 0xe0 0x1f 0xf1 0x0e 0xf1 0x0e
0xe0 0xe0 0xe0 0xe0 0xf1 0xf1 0xf1 0xf1
0xe0 0xfe 0xe0 0xfe 0xf1 0xfe 0xf1 0xfe
0xfe 0x01 0xfe 0x01 0xfe 0x01 0xfe 0x01
0xfe 0x1f 0xfe 0x1f 0xfe 0x0e 0xfe 0x0e
0xfe 0xe0 0xfe 0xe0 0xfe 0xf1 0xfe 0xf1
0xfe 0xfe 0xfe 0xfe 0xfe 0xfe 0xfe 0xfe
*/
/* key bit order in each method pair: bits 31->00 of 1st, bits 31->00 of 2nd */
/* this does not reflect the rotate of the 2nd word */
#define S(box,bit) (box*6+bit)
int korder[] = {
S(7, 5), S(7, 4), S(7, 3), S(7, 2), S(7, 1), S(7, 0),
S(5, 5), S(5, 4), S(5, 3), S(5, 2), S(5, 1), S(5, 0),
S(3, 5), S(3, 4), S(3, 3), S(3, 2), S(3, 1), S(3, 0),
S(1, 5), S(1, 4), S(1, 3), S(1, 2), S(1, 1), S(1, 0),
S(6, 5), S(6, 4), S(6, 3), S(6, 2), S(6, 1), S(6, 0),
S(4, 5), S(4, 4), S(4, 3), S(4, 2), S(4, 1), S(4, 0),
S(2, 5), S(2, 4), S(2, 3), S(2, 2), S(2, 1), S(2, 0),
S(0, 5), S(0, 4), S(0, 3), S(0, 2), S(0, 1), S(0, 0),
};
/* the order in which the algorithm accesses the s boxes */
int sorder[] = {
7, 5, 3, 1, 6, 4, 2, 0,
};
int printf(const char *, ...);
int
main(int argc UNUSED, char **argv UNUSED)
{
uint32_t d, i, j, k, l, m, n, s;