Crates.io | isochronous_finite_fields |
lib.rs | isochronous_finite_fields |
version | 1.0.1 |
source | src |
created_at | 2020-02-09 23:26:33.431296 |
updated_at | 2022-08-26 09:46:44.36452 |
description | Isochronous implementation of GF(2^8) arithmetic |
homepage | |
repository | https://github.com/ThijsRay/isochronous_finite_fields |
max_upload_size | |
id | 206858 |
size | 14,913 |
This crate implements finite field arithmetic on finite fields with 28 elements, often denoted as GF(28), in an isochronous manner. This means that it will always run in the same amount of time, no matter the input.
The implementation isochronous, because it:
This crate uses the irreducible polynomial x8 + x4 + x3 + x + 1 for multiplication, as standardized for the AES algorithm in FIPS 197.
// Add two elements of the Galois field GF(2^8) together.
assert_eq!(GF(5) + GF(12), GF(9));
// Subtract two elements of the Galois field GF(2^8).
assert_eq!(GF(32) - GF(219), GF(251));
// Multiply two elements of the Galois field GF(2^8) together.
assert_eq!(GF(175) * GF(47), GF(83));
// Calculate the multiplicative inverse of GF(110) in the Galois field GF(2^8).
assert_eq!(GF(110).multiplicative_inverse(), GF(33));
assert_eq!(GF(110) * GF(33), GF(1));
This project is licensed under the MIT License - see the LICENSE file for details.