Commit b0e2ae07abefbc7f5d3c7b19e165fe275b1eafcc

Authored by Jim Plank
1 parent 110523d6
Exists in master and in 3 other branches v1, v2, v3

Put headers on the C files.

License.txt
1   -Copyright (c) 2013, James S. Plank, Ethan L. Miller, William B. Houston
  1 +Copyright (c) 2013, James S. Plank, Ethan L. Miller, Kevin M. Greenan,
  2 +Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride
2 3 All rights reserved.
3 4  
4 5 Redistribution and use in source and binary forms, with or without
... ...
gf.c
1 1 /*
  2 + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic
  3 + * James S. Plank, Ethan L. Miller, Kevin M. Greenan,
  4 + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride.
  5 + *
2 6 * gf.c
3 7 *
4 8 * Generic routines for Galois fields
... ...
gf_add.c
1 1 /*
  2 + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic
  3 + * James S. Plank, Ethan L. Miller, Kevin M. Greenan,
  4 + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride.
  5 + *
2 6 * gf_add.c
3 7 *
4 8 * Adds two numbers in gf_2^w
... ...
gf_example_1.c
1 1 /*
  2 + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic
  3 + * James S. Plank, Ethan L. Miller, Kevin M. Greenan,
  4 + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride.
  5 + *
2 6 * gf_example_1.c
3 7 *
4 8 * Demonstrates using the procedures for examples in GF(2^w) for w <= 32.
... ...
gf_example_2.c
1 1 /*
  2 + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic
  3 + * James S. Plank, Ethan L. Miller, Kevin M. Greenan,
  4 + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride.
  5 + *
2 6 * gf_example_2.c
3 7 *
4 8 * Demonstrates using the procedures for examples in GF(2^w) for w <= 32.
... ...
gf_example_3.c
1 1 /*
  2 + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic
  3 + * James S. Plank, Ethan L. Miller, Kevin M. Greenan,
  4 + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride.
  5 + *
2 6 * gf_example_3.c
3 7 *
4 8 * Identical to example_2 except it works in GF(2^64)
... ...
gf_example_4.c
1 1 /*
  2 + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic
  3 + * James S. Plank, Ethan L. Miller, Kevin M. Greenan,
  4 + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride.
  5 + *
2 6 * gf_example_4.c
3 7 *
4 8 * Identical to example_3 except it works in GF(2^128)
... ...
gf_example_5.c
1 1 /*
  2 + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic
  3 + * James S. Plank, Ethan L. Miller, Kevin M. Greenan,
  4 + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride.
  5 + *
2 6 * gf_example_5.c
3 7 *
4 8 * Demonstrating altmap and extract_word
... ...
gf_example_6.c
1 1 /*
  2 + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic
  3 + * James S. Plank, Ethan L. Miller, Kevin M. Greenan,
  4 + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride.
  5 + *
2 6 * gf_example_6.c
3 7 *
4 8 * Demonstrating altmap and extract_word
... ...
gf_example_7.c
1 1 /*
  2 + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic
  3 + * James S. Plank, Ethan L. Miller, Kevin M. Greenan,
  4 + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride.
  5 + *
2 6 * gf_example_7.c
3 7 *
4 8 * Demonstrating extract_word and Cauchy
... ...
gf_general.c
1 1 /*
  2 + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic
  3 + * James S. Plank, Ethan L. Miller, Kevin M. Greenan,
  4 + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride.
  5 + *
2 6 * gf_general.c
3 7 *
4 8 * This file has helper routines for doing basic GF operations with any
... ...
gf_inline_time.c
1 1 /*
  2 + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic
  3 + * James S. Plank, Ethan L. Miller, Kevin M. Greenan,
  4 + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride.
  5 + *
2 6 * gf_inline_time.c
3 7 *
4 8 * Times inline single multiplication when w = 4, 8 or 16
... ...
gf_method.c
1 1 /*
  2 + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic
  3 + * James S. Plank, Ethan L. Miller, Kevin M. Greenan,
  4 + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride.
  5 + *
2 6 * gf_method.c
3 7 *
4 8 * Parses argv to figure out the mult_type and arguments. Returns the gf.
... ...
gf_methods.c
1 1 /*
  2 + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic
  3 + * James S. Plank, Ethan L. Miller, Kevin M. Greenan,
  4 + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride.
  5 + *
2 6 * gf_methods.c
3 7 *
4   - * Lists supported methods (incomplete w.r.t. GROUP and COMPOSITE
  8 + * Lists supported methods (incomplete w.r.t. GROUP and COMPOSITE)
5 9 */
6 10  
7 11 #include <stdio.h>
... ...
gf_mult.c
1 1 /*
  2 + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic
  3 + * James S. Plank, Ethan L. Miller, Kevin M. Greenan,
  4 + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride.
  5 + *
2 6 * gf_mult.c
3 7 *
4 8 * Multiplies two numbers in gf_2^w
... ...
gf_poly.c
1 1 /*
2   - gf_poly.c - program to help find irreducible polynomials in composite fields,
3   - using the Ben-Or algorithm.
4   -
5   - James S. Plank
6   -
7   - Please see the following paper for a
8   - description of the Ben-Or algorithm:
9   -
10   - author S. Gao and D. Panario
11   - title Tests and Constructions of Irreducible Polynomials over Finite Fields
12   - booktitle Foundations of Computational Mathematics
13   - year 1997
14   - publisher Springer Verlag
15   - pages 346-361
16   -
17   - The basic technique is this. You have a polynomial f(x) whose coefficients are
18   - in a base field GF(2^w). The polynomial is of degree n. You need to do the
19   - following for all i from 1 to n/2:
20   -
21   - Construct x^(2^w)^i modulo f. That will be a polynomial of maximum degree n-1
22   - with coefficients in GF(2^w). You construct that polynomial by starting with x
23   - and doubling it w times, each time taking the result modulo f. Then you
24   - multiply that by itself i times, again each time taking the result modulo f.
25   -
26   - When you're done, you need to "subtract" x -- since addition = subtraction =
27   - XOR, that means XOR x.
28   -
29   - Now, find the GCD of that last polynomial and f, using Euclid's algorithm. If
30   - the GCD is not one, then f is reducible. If it is not reducible for each of
31   - those i, then it is irreducible.
32   -
33   - In this code, I am using a gf_general_t to represent elements of GF(2^w). This
34   - is so that I can use base fields that are GF(2^64) or GF(2^128).
35   -
36   - I have two main procedures. The first is x_to_q_to_i_minus_x, which calculates
37   - x^(2^w)^i - x, putting the result into a gf_general_t * called retval.
38   -
39   - The second is gcd_one, which takes a polynomial of degree n and a second one
40   - of degree n-1, and uses Euclid's algorithm to decide if their GCD == 1.
41   -
42   - These can be made faster (e.g. calculate x^(2^w) once and store it).
  2 + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic
  3 + * James S. Plank, Ethan L. Miller, Kevin M. Greenan,
  4 + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride.
  5 + *
  6 + * gf_poly.c - program to help find irreducible polynomials in composite fields,
  7 + * using the Ben-Or algorithm.
  8 + *
  9 + * (This one was written by Jim)
  10 + *
  11 + * Please see the following paper for a description of the Ben-Or algorithm:
  12 + *
  13 + * author S. Gao and D. Panario
  14 + * title Tests and Constructions of Irreducible Polynomials over Finite Fields
  15 + * booktitle Foundations of Computational Mathematics
  16 + * year 1997
  17 + * publisher Springer Verlag
  18 + * pages 346-361
  19 + *
  20 + * The basic technique is this. You have a polynomial f(x) whose coefficients are
  21 + * in a base field GF(2^w). The polynomial is of degree n. You need to do the
  22 + * following for all i from 1 to n/2:
  23 + *
  24 + * Construct x^(2^w)^i modulo f. That will be a polynomial of maximum degree n-1
  25 + * with coefficients in GF(2^w). You construct that polynomial by starting with x
  26 + * and doubling it w times, each time taking the result modulo f. Then you
  27 + * multiply that by itself i times, again each time taking the result modulo f.
  28 + *
  29 + * When you're done, you need to "subtract" x -- since addition = subtraction =
  30 + * XOR, that means XOR x.
  31 + *
  32 + * Now, find the GCD of that last polynomial and f, using Euclid's algorithm. If
  33 + * the GCD is not one, then f is reducible. If it is not reducible for each of
  34 + * those i, then it is irreducible.
  35 + *
  36 + * In this code, I am using a gf_general_t to represent elements of GF(2^w). This
  37 + * is so that I can use base fields that are GF(2^64) or GF(2^128).
  38 + *
  39 + * I have two main procedures. The first is x_to_q_to_i_minus_x, which calculates
  40 + * x^(2^w)^i - x, putting the result into a gf_general_t * called retval.
  41 + *
  42 + * The second is gcd_one, which takes a polynomial of degree n and a second one
  43 + * of degree n-1, and uses Euclid's algorithm to decide if their GCD == 1.
  44 + *
  45 + * These can be made faster (e.g. calculate x^(2^w) once and store it).
43 46 */
44 47  
45 48 #include "gf_complete.h"
... ...
gf_rand.c
1 1 /*
  2 + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic
  3 + * James S. Plank, Ethan L. Miller, Kevin M. Greenan,
  4 + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride.
  5 + *
2 6 * gf_rand.c -- Random number generator.
3 7 */
4 8  
... ...
gf_time.c
1 1 /*
  2 + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic
  3 + * James S. Plank, Ethan L. Miller, Kevin M. Greenan,
  4 + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride.
  5 + *
2 6 * gf_time.c
3 7 *
4 8 * Performs timing for gf arithmetic
... ...
gf_unit.c
1 1 /*
  2 + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic
  3 + * James S. Plank, Ethan L. Miller, Kevin M. Greenan,
  4 + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride.
  5 + *
2 6 * gf_unit.c
3 7 *
4 8 * Performs unit testing for gf arithmetic
... ...
gf_w128.c
1 1 /*
  2 + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic
  3 + * James S. Plank, Ethan L. Miller, Kevin M. Greenan,
  4 + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride.
  5 + *
2 6 * gf_w128.c
3 7 *
4 8 * Routines for 128-bit Galois fields
... ...
gf_w16.c
1 1 /*
  2 + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic
  3 + * James S. Plank, Ethan L. Miller, Kevin M. Greenan,
  4 + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride.
  5 + *
2 6 * gf_w16.c
3 7 *
4 8 * Routines for 16-bit Galois fields
... ...
gf_w32.c
1 1 /*
  2 + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic
  3 + * James S. Plank, Ethan L. Miller, Kevin M. Greenan,
  4 + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride.
  5 + *
2 6 * gf_w32.c
3 7 *
4 8 * Routines for 32-bit Galois fields
... ...
gf_w4.c
1 1 /*
  2 + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic
  3 + * James S. Plank, Ethan L. Miller, Kevin M. Greenan,
  4 + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride.
  5 + *
2 6 * gf_w4.c
3 7 *
4 8 * Routines for 4-bit Galois fields
... ...
gf_w64.c
1 1 /*
  2 + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic
  3 + * James S. Plank, Ethan L. Miller, Kevin M. Greenan,
  4 + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride.
  5 + *
2 6 * gf_w64.c
3 7 *
4 8 * Routines for 64-bit Galois fields
... ...
gf_w8.c
1 1 /*
  2 + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic
  3 + * James S. Plank, Ethan L. Miller, Kevin M. Greenan,
  4 + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride.
  5 + *
2 6 * gf_w8.c
3 7 *
4 8 * Routines for 8-bit Galois fields
... ...
gf_wgen.c
1 1 /*
  2 + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic
  3 + * James S. Plank, Ethan L. Miller, Kevin M. Greenan,
  4 + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride.
  5 + *
2 6 * gf_wgen.c
3 7 *
4 8 * Routines for Galois fields for general w < 32. For specific w,
... ...