solana_zk_sdk/
lib.rs

1//! The `solana-zk-sdk` crate contains tools to create and verify zero-knowledge proofs on
2//! encrypted data.
3
4// The warning `clippy::op_ref` is disabled to allow efficient operator arithmetic of structs that
5// implement the `Copy` trait.
6//
7// ```
8// let opening_0: PedersenOpening = PedersenOpening::new_rand();
9// let opening_1: PedersenOpening = PedersenOpening::new_rand();
10//
11// // since PedersenOpening implement `Copy`, `opening_0` and `opening_1` will be copied as
12// // parameters before `opening_sum` is computed.
13// let opening_sum = opening_0 + opening_1;
14//
15// // if passed in as references, the extra copies will not occur
16// let opening_sum = &opening_0 + &opening_1;
17// ```
18//
19// `clippy::op_ref` is turned off to prevent clippy from warning that this is not idiomatic code.
20#![allow(clippy::arithmetic_side_effects, clippy::op_ref)]
21
22pub mod encryption;
23pub mod errors;
24pub mod pod;
25mod range_proof;
26mod sigma_proofs;
27#[cfg(not(target_os = "solana"))]
28mod transcript;
29pub mod zk_elgamal_proof_program;
30
31/// Byte length of a compressed Ristretto point or scalar in Curve255519
32const UNIT_LEN: usize = 32;
33/// Byte length of a compressed Ristretto point in Curve25519
34const RISTRETTO_POINT_LEN: usize = UNIT_LEN;
35/// Byte length of a scalar in Curve25519
36const SCALAR_LEN: usize = UNIT_LEN;