https://github.com/rspencer01/tinyfield
Small fields in no_std rust
https://github.com/rspencer01/tinyfield
finite-fields rust
Last synced: 4 months ago
JSON representation
Small fields in no_std rust
- Host: GitHub
- URL: https://github.com/rspencer01/tinyfield
- Owner: rspencer01
- License: mit
- Created: 2020-05-05T09:49:43.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-12-20T23:14:37.000Z (over 4 years ago)
- Last Synced: 2025-10-25T23:44:49.638Z (8 months ago)
- Topics: finite-fields, rust
- Language: Rust
- Homepage:
- Size: 46.9 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
Finite Fields In `no_std` Rust
==============================
[](https://travis-ci.org/rspencer01/tinyfield)
[](https://crates.io/crates/tinyfield)
[](https://coveralls.io/github/rspencer01/tinyfield?branch=master)
This crate exposes a number of small finite field types. It does not depend on
the standard library.
At time of writing, the top few results for "rust finite fields" in a google
search shows:
* A crate that no longer compiles, and doesn't implement finite fields
correctly at all
* A crate that only implements fields of characteristic two
* A crate that does general finite fields, but doesn't expose arithmetic past
addition for higher degree finite fields.
This crate attempts to supply:
* A small library with low footprint when linked
* Support for as many fields as I have energy to write irreducible polynomials for
* Small finite field elements (up to 32 bits only)
* Small characteristic fields only (fitting in one `u8`)
This crate does not attempt to:
* Be particularly fast
* Handle large primes suitable for, say, cryptography
This crate should, in the future:
* Handle all finite fields that fit within a `u32`
* Never rely on `std`
* Be a pleasure to use and have intuitive interfaces
* Have easy to understand code without unnecessary optimisation
Pull requests to make that happen would be most welcome.
Issues on the github tracker are also welcome.
Example usage
-------------
```rust
# use tinyfield::prime_power_field::*;
type F = tinyfield::fields::GF9;
let delta = F::elts()
.filter(|x| x * x - 2.into() == F::zero)
.next()
.expect("GF9 should contain a square root of two");
```