winter_crypto/
lib.rs

1// Copyright (c) Facebook, Inc. and its affiliates.
2//
3// This source code is licensed under the MIT license found in the
4// LICENSE file in the root directory of this source tree.
5
6//! This crate contains cryptographic primitives used in STARK proof generation and verification.
7//! These include:
8//!
9//! * **Hash functions** - which are defined using the [Hasher] trait. The crate also contains two
10//!   implementations of the trait for BLAKE3 and SHA3 hash functions.
11//! * **Merkle trees** - which are used as a commitment scheme in the STARK protocol. The
12//!   [MerkleTree] implementation supports concurrent tree construction as well as compact
13//!   aggregation of Merkle paths implemented using a variation of the
14//!   [Octopus](https://eprint.iacr.org/2017/933) algorithm.
15//! * **PRNG** - which is used to generate pseudo-random elements in a finite field. The
16//!   [RandomCoin] implementation uses a cryptographic hash function to generate pseudo-random
17//!   elements form a seed.
18
19#![no_std]
20
21#[macro_use]
22extern crate alloc;
23
24mod hash;
25pub use hash::{Digest, ElementHasher, Hasher};
26pub mod hashers {
27    //! Contains implementations of currently supported hash functions.
28
29    pub use super::hash::{Blake3_192, Blake3_256, Rp62_248, Rp64_256, RpJive64_256, Sha3_256};
30}
31
32mod merkle;
33#[cfg(feature = "concurrent")]
34pub use merkle::concurrent;
35pub use merkle::{build_merkle_nodes, BatchMerkleProof, MerkleTree};
36
37mod random;
38pub use random::{DefaultRandomCoin, RandomCoin};
39
40mod errors;
41pub use errors::{MerkleTreeError, RandomCoinError};
42
43mod commitment;
44pub use commitment::VectorCommitment;