1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//! 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](https://libntl.org/),
//! 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:
//!
//! ```toml
//! [dependencies]
//! ffnt = "0.11"
//! ```
//!
//! # Example
//!
//! ```rust
//! 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](https://github.com/a-maier/ffnt/tree/master/examples).
//!
//! # Features
//!
//! - `rand`: support for [random number generation](https://crates.io/crates/rand)
//! - `num-traits`: [numeric traits](https://crates.io/crates/num-traits)
//! - `serde`: [serialisation and deserialisation](https://crates.io/crates/serde)
/// Numeric traits
/// Random field element generation
/// Fields with a 32 bit characteristic
/// Fields with a 64 bit characteristic
pub use Z32;
pub use TryDiv;
pub use Z64;
pub use ParseIntError;