isochronous_finite_fields

Crates.ioisochronous_finite_fields
lib.rsisochronous_finite_fields
version1.0.1
sourcesrc
created_at2020-02-09 23:26:33.431296
updated_at2022-08-26 09:46:44.36452
descriptionIsochronous implementation of GF(2^8) arithmetic
homepage
repositoryhttps://github.com/ThijsRay/isochronous_finite_fields
max_upload_size
id206858
size14,913
Thijs Raymakers (ThijsRay)

documentation

README

Isochronous finite fields

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:

  • is branch free
  • runs in constant time
  • doesn't do table lookups

This crate uses the irreducible polynomial x8 + x4 + x3 + x + 1 for multiplication, as standardized for the AES algorithm in FIPS 197.

Example

// 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));

License

This project is licensed under the MIT License - see the LICENSE file for details.

Commit count: 19

cargo fmt