3 * $Id: safer-mktab.c,v 1.1 2001/04/29 17:49:54 mdw Exp $
5 * Generate tables for SAFER
7 * (c) 2001 Straylight/Edgeware
10 /*----- Licensing notice --------------------------------------------------*
12 * This file is part of Catacomb.
14 * Catacomb is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU Library General Public License as
16 * published by the Free Software Foundation; either version 2 of the
17 * License, or (at your option) any later version.
19 * Catacomb is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Library General Public License for more details.
24 * You should have received a copy of the GNU Library General Public
25 * License along with Catacomb; if not, write to the Free
26 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
30 /*----- Revision history --------------------------------------------------*
32 * $Log: safer-mktab.c,v $
33 * Revision 1.1 2001/04/29 17:49:54 mdw
34 * Added SAFER block cipher.
38 /*----- Header files ------------------------------------------------------*/
43 #include <mLib/bits.h>
45 /*----- Main code ---------------------------------------------------------*/
49 octet s
[256], si
[256];
53 for (i
= 0; i
< 256; i
++) {
66 * SAFER tables [generated]\n\
69 #ifndef CATACOMB_SAFER_TAB_H\n\
70 #define CATACOMB_SAFER_TAB_H\n\
75 /* --- S-boxes --- */\n\
77 #define SAFER_S { \\\n\
79 for (i
= 0; i
< 256; i
++) {
80 printf("0x%02x", s
[i
]);
82 fputs(" \\\n}\n\n", stdout
);
83 else if ((i
+ 1)%8 == 0)
84 fputs(", \\\n ", stdout
);
90 #define SAFER_SI { \\\n\
92 for (i
= 0; i
< 256; i
++) {
93 printf("0x%02x", si
[i
]);
95 fputs(" \\\n}\n\n", stdout
);
96 else if ((i
+ 1)%8 == 0)
97 fputs(", \\\n ", stdout
);
104 if (fclose(stdout
)) {
105 fprintf(stderr
, "error writing data\n");
112 /*----- That's all, folks -------------------------------------------------*/