shared_types/circuit_hash.rs
1//! Defines the [CircuitHashType] enum, which is used to specify the type of hash is used for the
2//! circuit description.
3
4use serde::{Deserialize, Serialize};
5
6/// Defines the type of hash used when adding a circuit description's hash
7/// into the transcript.
8#[derive(Clone, Copy, Debug, Serialize, Deserialize, PartialEq)]
9pub enum CircuitHashType {
10 /// This uses Rust's [std::collections::hash_map::DefaultHasher] implementation and uses the
11 /// #[derive(Hash)] implementation. The hash function implemented underneath is not
12 /// cryptographically secure, and thus this option is generally not recommended.
13 DefaultRustHash,
14 /// This converts the circuit description into a JSON string via
15 /// [serde::Serialize] and hashes the bytes using SHA3-256.
16 Sha3_256,
17 /// This converts the circuit description into a JSON string via
18 /// [serde::Serialize] and hashes the bytes in chunks of 16, converting
19 /// them first to field elements.
20 Poseidon,
21}