From b0e2ae07abefbc7f5d3c7b19e165fe275b1eafcc Mon Sep 17 00:00:00 2001 From: Jim Plank Date: Wed, 9 Oct 2013 11:00:24 -0400 Subject: [PATCH] Put headers on the C files. --- License.txt | 3 +- gf.c | 4 +++ gf_add.c | 4 +++ gf_example_1.c | 4 +++ gf_example_2.c | 4 +++ gf_example_3.c | 4 +++ gf_example_4.c | 4 +++ gf_example_5.c | 4 +++ gf_example_6.c | 4 +++ gf_example_7.c | 4 +++ gf_general.c | 4 +++ gf_inline_time.c | 4 +++ gf_method.c | 4 +++ gf_methods.c | 6 +++- gf_mult.c | 4 +++ gf_poly.c | 85 +++++++++++++++++++++++++----------------------- gf_rand.c | 4 +++ gf_time.c | 4 +++ gf_unit.c | 4 +++ gf_w128.c | 4 +++ gf_w16.c | 4 +++ gf_w32.c | 4 +++ gf_w4.c | 4 +++ gf_w64.c | 4 +++ gf_w8.c | 4 +++ gf_wgen.c | 4 +++ 26 files changed, 143 insertions(+), 43 deletions(-) diff --git a/License.txt b/License.txt index 17c5491..df8d9ed 100644 --- a/License.txt +++ b/License.txt @@ -1,4 +1,5 @@ -Copyright (c) 2013, James S. Plank, Ethan L. Miller, William B. Houston +Copyright (c) 2013, James S. Plank, Ethan L. Miller, Kevin M. Greenan, +Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/gf.c b/gf.c index b027473..2d00743 100644 --- a/gf.c +++ b/gf.c @@ -1,4 +1,8 @@ /* + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic + * James S. Plank, Ethan L. Miller, Kevin M. Greenan, + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride. + * * gf.c * * Generic routines for Galois fields diff --git a/gf_add.c b/gf_add.c index 545b4b7..b900e69 100644 --- a/gf_add.c +++ b/gf_add.c @@ -1,4 +1,8 @@ /* + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic + * James S. Plank, Ethan L. Miller, Kevin M. Greenan, + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride. + * * gf_add.c * * Adds two numbers in gf_2^w diff --git a/gf_example_1.c b/gf_example_1.c index a6dfe75..a7a4155 100644 --- a/gf_example_1.c +++ b/gf_example_1.c @@ -1,4 +1,8 @@ /* + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic + * James S. Plank, Ethan L. Miller, Kevin M. Greenan, + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride. + * * gf_example_1.c * * Demonstrates using the procedures for examples in GF(2^w) for w <= 32. diff --git a/gf_example_2.c b/gf_example_2.c index 73a7826..e98774a 100644 --- a/gf_example_2.c +++ b/gf_example_2.c @@ -1,4 +1,8 @@ /* + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic + * James S. Plank, Ethan L. Miller, Kevin M. Greenan, + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride. + * * gf_example_2.c * * Demonstrates using the procedures for examples in GF(2^w) for w <= 32. diff --git a/gf_example_3.c b/gf_example_3.c index 75afe69..d6fef87 100644 --- a/gf_example_3.c +++ b/gf_example_3.c @@ -1,4 +1,8 @@ /* + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic + * James S. Plank, Ethan L. Miller, Kevin M. Greenan, + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride. + * * gf_example_3.c * * Identical to example_2 except it works in GF(2^64) diff --git a/gf_example_4.c b/gf_example_4.c index c5a37ea..17529b5 100644 --- a/gf_example_4.c +++ b/gf_example_4.c @@ -1,4 +1,8 @@ /* + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic + * James S. Plank, Ethan L. Miller, Kevin M. Greenan, + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride. + * * gf_example_4.c * * Identical to example_3 except it works in GF(2^128) diff --git a/gf_example_5.c b/gf_example_5.c index 3e303a3..8e7dd4e 100644 --- a/gf_example_5.c +++ b/gf_example_5.c @@ -1,4 +1,8 @@ /* + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic + * James S. Plank, Ethan L. Miller, Kevin M. Greenan, + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride. + * * gf_example_5.c * * Demonstrating altmap and extract_word diff --git a/gf_example_6.c b/gf_example_6.c index 86dda11..54cdf83 100644 --- a/gf_example_6.c +++ b/gf_example_6.c @@ -1,4 +1,8 @@ /* + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic + * James S. Plank, Ethan L. Miller, Kevin M. Greenan, + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride. + * * gf_example_6.c * * Demonstrating altmap and extract_word diff --git a/gf_example_7.c b/gf_example_7.c index 445ae20..cd5c44b 100644 --- a/gf_example_7.c +++ b/gf_example_7.c @@ -1,4 +1,8 @@ /* + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic + * James S. Plank, Ethan L. Miller, Kevin M. Greenan, + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride. + * * gf_example_7.c * * Demonstrating extract_word and Cauchy diff --git a/gf_general.c b/gf_general.c index 02efdc7..9980c97 100644 --- a/gf_general.c +++ b/gf_general.c @@ -1,4 +1,8 @@ /* + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic + * James S. Plank, Ethan L. Miller, Kevin M. Greenan, + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride. + * * gf_general.c * * This file has helper routines for doing basic GF operations with any diff --git a/gf_inline_time.c b/gf_inline_time.c index 55709cd..e64f0b3 100644 --- a/gf_inline_time.c +++ b/gf_inline_time.c @@ -1,4 +1,8 @@ /* + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic + * James S. Plank, Ethan L. Miller, Kevin M. Greenan, + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride. + * * gf_inline_time.c * * Times inline single multiplication when w = 4, 8 or 16 diff --git a/gf_method.c b/gf_method.c index bc9bd35..36ec3c4 100644 --- a/gf_method.c +++ b/gf_method.c @@ -1,4 +1,8 @@ /* + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic + * James S. Plank, Ethan L. Miller, Kevin M. Greenan, + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride. + * * gf_method.c * * Parses argv to figure out the mult_type and arguments. Returns the gf. diff --git a/gf_methods.c b/gf_methods.c index c4db5f5..147e7e7 100644 --- a/gf_methods.c +++ b/gf_methods.c @@ -1,7 +1,11 @@ /* + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic + * James S. Plank, Ethan L. Miller, Kevin M. Greenan, + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride. + * * gf_methods.c * - * Lists supported methods (incomplete w.r.t. GROUP and COMPOSITE + * Lists supported methods (incomplete w.r.t. GROUP and COMPOSITE) */ #include diff --git a/gf_mult.c b/gf_mult.c index c93a4f9..815bd8b 100644 --- a/gf_mult.c +++ b/gf_mult.c @@ -1,4 +1,8 @@ /* + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic + * James S. Plank, Ethan L. Miller, Kevin M. Greenan, + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride. + * * gf_mult.c * * Multiplies two numbers in gf_2^w diff --git a/gf_poly.c b/gf_poly.c index 7134b2c..e19706c 100644 --- a/gf_poly.c +++ b/gf_poly.c @@ -1,45 +1,48 @@ /* - gf_poly.c - program to help find irreducible polynomials in composite fields, - using the Ben-Or algorithm. - - James S. Plank - - Please see the following paper for a - description of the Ben-Or algorithm: - - author S. Gao and D. Panario - title Tests and Constructions of Irreducible Polynomials over Finite Fields - booktitle Foundations of Computational Mathematics - year 1997 - publisher Springer Verlag - pages 346-361 - - The basic technique is this. You have a polynomial f(x) whose coefficients are - in a base field GF(2^w). The polynomial is of degree n. You need to do the - following for all i from 1 to n/2: - - Construct x^(2^w)^i modulo f. That will be a polynomial of maximum degree n-1 - with coefficients in GF(2^w). You construct that polynomial by starting with x - and doubling it w times, each time taking the result modulo f. Then you - multiply that by itself i times, again each time taking the result modulo f. - - When you're done, you need to "subtract" x -- since addition = subtraction = - XOR, that means XOR x. - - Now, find the GCD of that last polynomial and f, using Euclid's algorithm. If - the GCD is not one, then f is reducible. If it is not reducible for each of - those i, then it is irreducible. - - In this code, I am using a gf_general_t to represent elements of GF(2^w). This - is so that I can use base fields that are GF(2^64) or GF(2^128). - - I have two main procedures. The first is x_to_q_to_i_minus_x, which calculates - x^(2^w)^i - x, putting the result into a gf_general_t * called retval. - - The second is gcd_one, which takes a polynomial of degree n and a second one - of degree n-1, and uses Euclid's algorithm to decide if their GCD == 1. - - These can be made faster (e.g. calculate x^(2^w) once and store it). + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic + * James S. Plank, Ethan L. Miller, Kevin M. Greenan, + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride. + * + * gf_poly.c - program to help find irreducible polynomials in composite fields, + * using the Ben-Or algorithm. + * + * (This one was written by Jim) + * + * Please see the following paper for a description of the Ben-Or algorithm: + * + * author S. Gao and D. Panario + * title Tests and Constructions of Irreducible Polynomials over Finite Fields + * booktitle Foundations of Computational Mathematics + * year 1997 + * publisher Springer Verlag + * pages 346-361 + * + * The basic technique is this. You have a polynomial f(x) whose coefficients are + * in a base field GF(2^w). The polynomial is of degree n. You need to do the + * following for all i from 1 to n/2: + * + * Construct x^(2^w)^i modulo f. That will be a polynomial of maximum degree n-1 + * with coefficients in GF(2^w). You construct that polynomial by starting with x + * and doubling it w times, each time taking the result modulo f. Then you + * multiply that by itself i times, again each time taking the result modulo f. + * + * When you're done, you need to "subtract" x -- since addition = subtraction = + * XOR, that means XOR x. + * + * Now, find the GCD of that last polynomial and f, using Euclid's algorithm. If + * the GCD is not one, then f is reducible. If it is not reducible for each of + * those i, then it is irreducible. + * + * In this code, I am using a gf_general_t to represent elements of GF(2^w). This + * is so that I can use base fields that are GF(2^64) or GF(2^128). + * + * I have two main procedures. The first is x_to_q_to_i_minus_x, which calculates + * x^(2^w)^i - x, putting the result into a gf_general_t * called retval. + * + * The second is gcd_one, which takes a polynomial of degree n and a second one + * of degree n-1, and uses Euclid's algorithm to decide if their GCD == 1. + * + * These can be made faster (e.g. calculate x^(2^w) once and store it). */ #include "gf_complete.h" diff --git a/gf_rand.c b/gf_rand.c index beee123..a9aa7ad 100644 --- a/gf_rand.c +++ b/gf_rand.c @@ -1,4 +1,8 @@ /* + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic + * James S. Plank, Ethan L. Miller, Kevin M. Greenan, + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride. + * * gf_rand.c -- Random number generator. */ diff --git a/gf_time.c b/gf_time.c index 55f3e11..2bd2d04 100644 --- a/gf_time.c +++ b/gf_time.c @@ -1,4 +1,8 @@ /* + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic + * James S. Plank, Ethan L. Miller, Kevin M. Greenan, + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride. + * * gf_time.c * * Performs timing for gf arithmetic diff --git a/gf_unit.c b/gf_unit.c index fbc21f9..434763d 100644 --- a/gf_unit.c +++ b/gf_unit.c @@ -1,4 +1,8 @@ /* + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic + * James S. Plank, Ethan L. Miller, Kevin M. Greenan, + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride. + * * gf_unit.c * * Performs unit testing for gf arithmetic diff --git a/gf_w128.c b/gf_w128.c index 1465be5..3aa3758 100644 --- a/gf_w128.c +++ b/gf_w128.c @@ -1,4 +1,8 @@ /* + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic + * James S. Plank, Ethan L. Miller, Kevin M. Greenan, + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride. + * * gf_w128.c * * Routines for 128-bit Galois fields diff --git a/gf_w16.c b/gf_w16.c index 6bc25a6..d036bc2 100644 --- a/gf_w16.c +++ b/gf_w16.c @@ -1,4 +1,8 @@ /* + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic + * James S. Plank, Ethan L. Miller, Kevin M. Greenan, + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride. + * * gf_w16.c * * Routines for 16-bit Galois fields diff --git a/gf_w32.c b/gf_w32.c index cae188f..956f667 100644 --- a/gf_w32.c +++ b/gf_w32.c @@ -1,4 +1,8 @@ /* + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic + * James S. Plank, Ethan L. Miller, Kevin M. Greenan, + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride. + * * gf_w32.c * * Routines for 32-bit Galois fields diff --git a/gf_w4.c b/gf_w4.c index 50f00da..8f14182 100644 --- a/gf_w4.c +++ b/gf_w4.c @@ -1,4 +1,8 @@ /* + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic + * James S. Plank, Ethan L. Miller, Kevin M. Greenan, + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride. + * * gf_w4.c * * Routines for 4-bit Galois fields diff --git a/gf_w64.c b/gf_w64.c index 12ec5af..a0e4717 100644 --- a/gf_w64.c +++ b/gf_w64.c @@ -1,4 +1,8 @@ /* + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic + * James S. Plank, Ethan L. Miller, Kevin M. Greenan, + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride. + * * gf_w64.c * * Routines for 64-bit Galois fields diff --git a/gf_w8.c b/gf_w8.c index 45c500f..86a685a 100644 --- a/gf_w8.c +++ b/gf_w8.c @@ -1,4 +1,8 @@ /* + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic + * James S. Plank, Ethan L. Miller, Kevin M. Greenan, + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride. + * * gf_w8.c * * Routines for 8-bit Galois fields diff --git a/gf_wgen.c b/gf_wgen.c index ede115c..f5e22e0 100644 --- a/gf_wgen.c +++ b/gf_wgen.c @@ -1,4 +1,8 @@ /* + * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic + * James S. Plank, Ethan L. Miller, Kevin M. Greenan, + * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride. + * * gf_wgen.c * * Routines for Galois fields for general w < 32. For specific w,