(WiP) Fast and easy polynomial quotient ring arithmetic for lattice crypto in Rust
Find a file
2026-02-20 16:02:58 +01:00
examples Feature-complete for implementing real crypto 2025-08-29 22:58:23 +02:00
src v0.1.0 2026-02-20 16:02:58 +01:00
.gitignore Feature-complete for implementing real crypto 2025-08-29 22:58:23 +02:00
Cargo.lock v0.1.0 2026-02-20 16:02:58 +01:00
Cargo.toml v0.1.0 2026-02-20 16:02:58 +01:00
LICENSE license, readme 2025-07-21 19:47:58 +02:00
README.md v0.1.0 2026-02-20 16:02:58 +01:00
rustfmt.toml Initial commit 2025-07-21 19:34:51 +02:00

gwrizienn

Modular arithmetic, polynomial quotient rings in Rust.

Goals:

  • Easy to use, obvious when you look at the documentation and type system
  • Fast, most possible work is done at compile time
  • All the math you need for implementing cryptographic schemes such as Dilithium

Non-goals:

  • Generic (it's generic but only for primitive types)
  • Complete (it's simple because it's not a complete implementation of modern algebra)
  • Dynamic (vector dimensions and moduli are strongly typed)
  • Footgun-free (if you give incoherent arguments to the macros, it may produce unsafe code)

Supported:

  • ring Zq
  • ring Zq/(x^N+1) with additive operations
  • ring Zq/(x^N+1) with multiplicative operations if q=p or q=2p with p prime and 2N divides p-1
  • vectors and matrices of the above rings
  • lift between different rings (see example ntwe) (lifting may lack some features or be unsafe)

Warning: There are some TODOs in the code. The code has not been audited nor proven. Please don't use it in production yet.

Why

When implementing Dilithium and other similar lattice-based schemes, I found no crate that was both easy and fast, so I made one with the exact set of features I needed.

Name

Pronounce grizienn. It's Breton for "root", because we use roots of unity to compute the NTT for faster O(N log N) polynomial multiplication.

License

Support me via LiberaPay

GNU AGPL v3, CopyLeft 2025-2026 Pascal Engélibert (why copyleft?)

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, version 3 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.