projects
/
u
/
mdw
/
catacomb
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
dh_kcdsagen: Generate cofactor first.
[u/mdw/catacomb]
/
twofish-mktab.c
diff --git
a/twofish-mktab.c
b/twofish-mktab.c
index
5a649f3
..
4acbf73
100644
(file)
--- a/
twofish-mktab.c
+++ b/
twofish-mktab.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id: twofish-mktab.c,v 1.
1 2000/06/17 12:10:17
mdw Exp $
+ * $Id: twofish-mktab.c,v 1.
5 2004/04/08 01:36:15
mdw Exp $
*
* Build constant tables for Twofish
*
*
* Build constant tables for Twofish
*
@@
-27,14
+27,6
@@
* MA 02111-1307, USA.
*/
* MA 02111-1307, USA.
*/
-/*----- Revision history --------------------------------------------------*
- *
- * $Log: twofish-mktab.c,v $
- * Revision 1.1 2000/06/17 12:10:17 mdw
- * New cipher.
- *
- */
-
/*----- Header files ------------------------------------------------------*/
#include <stdio.h>
/*----- Header files ------------------------------------------------------*/
#include <stdio.h>
@@
-175,14
+167,14
@@
static void printq(const q_tab *q, const char *name)
}
}
}
}
-/*-----
GF(2^8) arithmetic -----
-------------------------------------------*/
+/*-----
%$\gf{2^8}$% arithmetic
-------------------------------------------*/
#define MDS_MOD 0x169
#define RS_MOD 0x14d
/* --- @mul@ --- *
*
#define MDS_MOD 0x169
#define RS_MOD 0x14d
/* --- @mul@ --- *
*
- * Arguments: @unsigned x, y@ = polynomials over %$\
mathrm{GF}(2^8)
$%
+ * Arguments: @unsigned x, y@ = polynomials over %$\
gf{2^8}
$%
* @unsigned m@ = modulus
*
* Returns: The product of two polynomials.
* @unsigned m@ = modulus
*
* Returns: The product of two polynomials.
@@
-219,7
+211,7
@@
static unsigned mul(unsigned x, unsigned y, unsigned m)
* Returns: ---
*
* Use: Computes an inner product of matrices over the finite field
* Returns: ---
*
* Use: Computes an inner product of matrices over the finite field
- * %$\
mathrm{GF}(2^8)[x]/m(x
)$%. This isn't particularly rapid.
+ * %$\
gf{2^8}[x]/(m(x)
)$%. This isn't particularly rapid.
*/
static void mmul(octet *d, const octet *p, const octet *q,
*/
static void mmul(octet *d, const octet *p, const octet *q,
@@
-310,7
+302,7
@@
static void rslog(void)
unsigned i;
rslog[0] = 0;
unsigned i;
rslog[0] = 0;
- for (i = 0; i < 25
6
; i++) {
+ for (i = 0; i < 25
5
; i++) {
rslog[x] = i;
rsexp[i] = x;
x <<= 1;
rslog[x] = i;
rsexp[i] = x;
x <<= 1;
@@
-350,7
+342,7
@@
static void rslog(void)
for (i = 0; i < 255 + x + 1; i++) {
printf("0x%02x", rsexp[i % 255]);
if (i == 255 + x)
for (i = 0; i < 255 + x + 1; i++) {
printf("0x%02x", rsexp[i % 255]);
if (i == 255 + x)
- puts(" \\\n}\n");
+ puts("
\\\n}\n");
else if (i % 8 == 7)
fputs(", \\\n ", stdout);
else
else if (i % 8 == 7)
fputs(", \\\n ", stdout);
else
@@
-381,14
+373,14
@@
static void rslog(void)
int main(void)
{
fputs("\
int main(void)
{
fputs("\
-/* -*-c-*-
- *
+/* -*-c-*-
\n\
+ *
\n\
* Twofish q tables [generated]\n\
* Twofish q tables [generated]\n\
- */
-
-#ifndef CATACOMB_TWOFISH_TAB_H
-#define CATACOMB_TWOFISH_TAB_H
-
+ */
\n\
+\n\
+#ifndef CATACOMB_TWOFISH_TAB_H
\n\
+#define CATACOMB_TWOFISH_TAB_H
\n\
+\n\
", stdout);
/* --- The q tables --- */
", stdout);
/* --- The q tables --- */