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