X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/8dd8c294e9f330eb6b975c2b96cf9bbfcd087e5e..f41f820e4b3e230d9314cc4323abf59babdd4e67:/twofish-mktab.c diff --git a/twofish-mktab.c b/twofish-mktab.c index 5a649f3..e30d4cc 100644 --- a/twofish-mktab.c +++ b/twofish-mktab.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: twofish-mktab.c,v 1.1 2000/06/17 12:10:17 mdw Exp $ + * $Id: twofish-mktab.c,v 1.3 2000/06/26 17:14:42 mdw Exp $ * * Build constant tables for Twofish * @@ -30,6 +30,14 @@ /*----- Revision history --------------------------------------------------* * * $Log: twofish-mktab.c,v $ + * Revision 1.3 2000/06/26 17:14:42 mdw + * (rslog): Ensure that log(1) = 0 (not 255, as previously). While the two + * are strictly equivalent, it means that the exp table is larger than it + * otherwise needs to be. + * + * Revision 1.2 2000/06/18 23:12:15 mdw + * Change typesetting of Galois Field names. + * * Revision 1.1 2000/06/17 12:10:17 mdw * New cipher. * @@ -175,14 +183,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@ --- * * - * 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. @@ -219,7 +227,7 @@ static unsigned mul(unsigned x, unsigned y, unsigned m) * 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, @@ -310,7 +318,7 @@ static void rslog(void) unsigned i; rslog[0] = 0; - for (i = 0; i < 256; i++) { + for (i = 0; i < 255; i++) { rslog[x] = i; rsexp[i] = x; x <<= 1; @@ -350,7 +358,7 @@ static void rslog(void) 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