2 releases

0.1.1 Jun 10, 2019
0.1.0 Jun 9, 2019

#1595 in Math

Apache-2.0

14KB
327 lines

nicolas

Example

use nicolas::galois::{GenGF2E, GF2E, Poly2};

// Declares the irreducible polynomial. Here it's x^4 + x + 1.
let p = Poly2::new(0b10011)

// 8 means that use GF(2^4). 
let g = GenGF2E::new(4, p);

// Generates a new element(x) of GF(2^4).
let a = g.gen(Poly2::new(0b10));

// Generates a new element(x) of GF(2^4).
let b = g.gen(Poly2::new(0b10));

// Addition
let _ = a + b;

// Subtraction
let _ = a - b;

// Multiply
let _ = a * b;

// Converts to u64
let _ = a.as_u64();

lib.rs:

Computer Algebra Library.

Dependencies

~2MB
~48K SLoC