Skip to content

a-maier/ffnt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ffnt

This crate provides prime fields with a characteristic that fits inside a 62 bit (or 30 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.11"

Example

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

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

// sum up all elements of the field
let sum: Z64<P> = (1..P).map(Z64::from).sum();

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

About

Finite fields for number theory

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages