5 unstable releases

0.7.2 May 17, 2024
0.7.1 May 6, 2024
0.7.0 May 6, 2024
0.6.0 Feb 12, 2024
0.5.1 Jan 26, 2024

#286 in Math

Download history 25/week @ 2024-02-17 23/week @ 2024-02-24 3/week @ 2024-03-02 27/week @ 2024-03-30 6/week @ 2024-04-06 241/week @ 2024-05-04 123/week @ 2024-05-11 48/week @ 2024-05-18 2/week @ 2024-05-25 1/week @ 2024-06-01

182 downloads per month

GPL-3.0-or-later

69KB
2K SLoC

ffnt

This crate provides prime fields with a characteristic that fits inside a 64 bit (or 32 bit) integer.

It is mostly intended for number-theoretical applications. All algorithms are taken from the NTL library, but for performance and safety reasons the field characteristic is set at compile time.

This crate is not suitable for applications in cryptography

Usage

Add this to your Cargo.toml:

[dependencies]
ffnt = "0.7"

Example

use ffnt::Z64; // or Z32 if the characteristic fits inside 32 bits

// the field characteristic
const P: u64 = 113;

// sum up all elements of the field
let sum = (1..P).map(Z64::<P>::from)
   .reduce(|acc, t| acc + t)
   .unwrap();

// check that the elements sum to 0
// if `num-traits` is enabled it is even better to use `sum.is_zero()`
assert_eq!(sum, Z64::<P>::from(0));

For more examples see the examples directory.

Features

License: GPL-3.0-or-later

Dependencies

~0–275KB