```/*
ecc Version 1.2  by Paul Flaherty (paulf at stanford.edu)
Copyright (C) 1993 Free Software Foundation, Inc.

This program is free software; you can redistribute it and/or modify
the Free Software Foundation; either version 2, or (at your option)
any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

/* gflib.c
Math Library for GF[256]

This file contains a number of mathematical functions for GF[256].
Entry and result are always assumed to be in vector notation, since
said notation allows for the zero element.  Attempting to reciprocate
the zero element results in process exit 42.
*/

#include "gf.h"

/* Multiply two field elements */

unsigned char
gfmul (mul1, mul2)

unsigned char mul1, mul2;
{
unsigned char mul3;
if (mul1 == 0 || mul2 == 0)
mul3 = 0;
else
mul3 = e2v[(v2e[mul1] + v2e[mul2]) % 255];
return (mul3);
}

unsigned char

{
}

/* Invert a field element, for division */

unsigned char
gfinv (ivt)

unsigned char ivt;
{
unsigned char ivtd;
if (ivt == 0)
exit (42);
ivtd = e2v[255 - v2e[ivt]];
return (ivtd);
}

/* Exponentiation.  Convert to exponential notation, mod 255 */

unsigned char
gfexp (mant, powr)

unsigned char mant, powr;
{
unsigned char expt;
if (mant == 0)
expt = 0;
else
expt = e2v[(v2e[mant] * powr) % 255];
return (expt);
}
```

 file: /Techref/method/error/rs-255-248-7-pf-1993/gflib_c.htm, 7KB, , updated: 2000/5/10 13:17, local time: 2023/5/28 05:57, TOP NEW HELP FIND:  18.232.31.255:LOG IN

 ©2023 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?Please DO link to this page! Digg it! / MAKE! Colorized Source Code

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.

Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
 Did you find what you needed? "No. I'm looking for: " "No. Take me to the search page." "No. Take me to the top so I can drill down by catagory" "No. I'm willing to pay for help, please refer me to a qualified consultant"

Welcome to sxlist.com!

Site supported by
& kind contributors
just like you!

(here's why

Copies of the site on CD
are available at minimal cost.

.