| Crates.io | nicolas |
| lib.rs | nicolas |
| version | 0.1.1 |
| created_at | 2019-06-09 06:32:40.956054+00 |
| updated_at | 2019-06-10 00:32:08.256962+00 |
| description | Computational Algebra Library |
| homepage | https://github.com/shinnya/nicolas |
| repository | https://github.com/shinnya/nicolas |
| max_upload_size | |
| id | 139918 |
| size | 24,124 |
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();