### 57 releases (37 breaking)

0.42.0-alpha.2 | Apr 26, 2024 |
---|---|

0.40.0 | Apr 16, 2024 |

0.38.0 | Feb 28, 2024 |

0.36.0 | Dec 22, 2023 |

0.7.2 | Nov 23, 2022 |

#**65** in Cryptography

**1,602** downloads per month

Used in **5** crates
(4 directly)

**GPL-2.0**license

620KB

13K
SLoC

# twenty-first

A collection of cryptography primitives written in Rust.

## Content of this library

This library contains primarily the following cryptographic primitives:

- The Tip5 hash function
- Lattice-crypto
- arithmetic for the quotient ring $\mathbb{F}_ p[X] / \langle X^{64} + 1 \rangle$
- arithmetic for modules over this quotient ring
- a IND-CCA2-secure key encapsulation mechanism
- Lattice-Based Cryptography in Miden VM

,`BFieldElement``XFieldElement`- The prime-field type $\mathbb{F}_p$ where $p = 2^{64} - 2^{32} + 1$
- The extension field $\mathbb{F}_p[x]/(x^3 - x + 1)$
- A codec trait for encoding and decoding structs as

s of`Vec``BFieldElement` - An efficient prime for number-theoretic transforms

- NTT
- Number Theoretic Transform (discrete Fast Fourier Transform)
- Anatomy of a STARK, Part 6: Speeding Things Up

- Univariate and multivariate polynomials
- Merkle Trees
- Merkle Mountain Ranges

## Release protocol

While twenty-first's version is

, releasing a new version:`0.`x`.`y

- Is the release backwards-compatible?
Then the new version is

. Otherwise the new version is`0.`x`.`y`+``1`

.`0.`x`+``1.``0` - Checkout the last commit on Mjolnir, and run

. Save the benchmark's result and verify that there is no performance degredation.`make``bench-publish` - Create a commit that increases

in twenty-first/Cargo.toml. The commit message should give a one-line summary of each release change. Include the benchmark result at the bottom.`version``=``"`0.x.y`"` - Have a

git tag on this commit created. (`v0``.`x`.`y

,`git``tag v0.x.y``[`sha`]`

)`git``push upstream``--`tags - Have this commit

ed on crates.io and in GitHub tags.`cargo``publish`

If you do not have the privilege to create git tags or run

, submit a PR and the merger will take care of these.`cargo`` publish`

## Building

This crate depends on the rs-leveldb crate which wraps the C++ implementation of leveldb. As such,

and `snappy`

must be installed. Eg, on Ubuntu:`leveldb`

`sudo`` apt-get install libleveldb-dev libsnappy-dev`

For more detailed buildings instructions, see the description in

.`HACKING.md`

#### Dependencies

~10MB

~181K SLoC