Skip to main content

Crate midnight_transient_crypto

Crate midnight_transient_crypto 

Source
Expand description

This crate collects cryptographic primitives used in Midnight’s ledger. All primitives, including zero-knowledge, curve choice, and crypto-aware data structures are defined here, and should be added here to decouple from any specific implementation.

Modules§

commitment
(Homomorphic) commitment schemes used in Midnight.
curve
Curve selection for Midnight. This may change over time, but we are likely to keep:
encryption
SNARK-friendly public key encryption. Our encryption scheme is: We use part of El Gamal to establish a shared secret K* (a point in the embedded curve) between sender and receiver. (Receiver’s PK: g^x, we send g^y to establish K* = g^{xy}) We derive a key K in the main curve as H(K*.x, K*.y), where H is our transient hash.
fab
Defines the primitives of the field-aligned binary representation, where values are represented as sequences of binary strings, that are tied to an alignment which can be used to interpret them either as binary data, or a sequence of field elements for proving.
hash
Hashing functions for use across Midnight.
merkle_tree
Sparse, fixed-depth Merkle trees.
proofs
This module provides access to creating, and verifying zero-knowledge proofs. It assumes that keys and IR are generated externally, which is the focus of Compact.
repr
This module deals with representing data as sequences of binary objects for use in persistent hashing, and as field elements for use in proofs, primarily through the FieldRepr, BinaryHashRepr, and FromFieldRepr traits.