GaloisLib is a
C++ library for doing arithmetic with finite fields. It implements the Generic Ring Interface and it can be used within any algorithm exploiting such an interface. Do not be fooled by the buzzing name: this means, roughly, that the class defines
+, -, *, /together with their "assignement" versions such as
!=together with specialized methods
x.is_zero()gives the same result of
x == 0, but the former is more efficient)
one()which return, respectively, the "0" and the "1" of the finite field
gf2.H) this gives a template class which implements only fields of characteristic 2, i.e., . The advantage of this library is its efficiency since every element is stored as an -bit integer. This makes sum and multiplication more efficient (for example, sum boils down to a bitwise xor).
gf.H) this gives a template class which implements generic finite fields . This is library is more general, but less efficient since field elements must be stored as vectors of integers between 0 and and this makes sum and product more expensive.
galois.H) this is not a template library, but a "normal" class which implements generic finite fields . The advantage of this library is that allows for changing the field at runtime, while GF2 and GF fix the field size at compile time. Altough this is more flexible, we loose compile time type checking.
How do I use it?
Briefly, in order to use one of the offered libraries (GF2, GF or GALOIS) you need to
libgalois.a(usually this means to add
-lgaloisin the linking phase)
Of course, if you installed the headers/the library in a directory which is not a "standard" one, you will need to give to the compiler the corresponding
You can find some examples of usage in the example directory.
Where can I find it?
You can download the tarball from http://www.diegm.uniud.it/bernardini/Software/Cplusplus
How do install it?
The tarball follows the GNU conventions and if you already installed GNU software from sources you should not have any problem: it is the usual "configure, make, make install" stuff.
tar zxvf galoislib-1.0.tar.gz
this should create a subdirectory galoislib-1.0
cd galoislib-1.0and configure the package with
If you want to install the file in a different tree from the default one (
/usr/local/) you can use
and the files will be installed in
/new/dir/lib. In this case be sure to pass options
-L to your compiler when you compile/link.
More detailed instruction can be found in the INSTALL file.