pub struct SetupParams<G: AffineRepr> {
pub G: G,
pub G_vec: Vec<G>,
pub H_vec: Vec<G>,
}Fields§
§G: G§G_vec: Vec<G>§H_vec: Vec<G>Implementations§
Source§impl<G: AffineRepr> SetupParams<G>
impl<G: AffineRepr> SetupParams<G>
pub fn new<D: Digest>(label: &[u8], g_count: u32, h_count: u32) -> Self
Sourcepub fn new_for_perfect_range_proof<D: Digest>(
label: &[u8],
base: u16,
num_value_bits: u16,
num_proofs: u32,
) -> Self
pub fn new_for_perfect_range_proof<D: Digest>( label: &[u8], base: u16, num_value_bits: u16, num_proofs: u32, ) -> Self
Create setup params for perfect range, i.e a range of form [0, base^l)
Sourcepub fn new_for_arbitrary_range_proof<D: Digest>(
label: &[u8],
base: u16,
num_value_bits: u16,
num_proofs: u32,
) -> Self
pub fn new_for_arbitrary_range_proof<D: Digest>( label: &[u8], base: u16, num_value_bits: u16, num_proofs: u32, ) -> Self
Create setup params for an arbitrary range, i.e a range of form [a, b)
Sourcepub fn compute_pedersen_commitment(&self, v: u64, gamma: &G::ScalarField) -> G
pub fn compute_pedersen_commitment(&self, v: u64, gamma: &G::ScalarField) -> G
Create Pedersen commitment as C = v*G + gamma*H_vec[0]
Sourcepub fn compute_commitment(
&self,
v: &G::ScalarField,
l: &[G::ScalarField],
n: &[G::ScalarField],
) -> G
pub fn compute_commitment( &self, v: &G::ScalarField, l: &[G::ScalarField], n: &[G::ScalarField], ) -> G
Returns v*g + <g_vec, n> + <h_vec, l>
Sourcepub fn compute_commitment_given_bases(
v: &G::ScalarField,
l: &[G::ScalarField],
n: &[G::ScalarField],
g: &G,
g_vec: &[G],
h_vec: &[G],
) -> G
pub fn compute_commitment_given_bases( v: &G::ScalarField, l: &[G::ScalarField], n: &[G::ScalarField], g: &G, g_vec: &[G], h_vec: &[G], ) -> G
Returns v*g + <g_vec, n> + <h_vec, l>
Sourcepub fn gen_randomness_and_compute_commitment<R: RngCore>(
&self,
rng: &mut R,
l: &[G::ScalarField],
n: &[G::ScalarField],
) -> (G::ScalarField, G)
pub fn gen_randomness_and_compute_commitment<R: RngCore>( &self, rng: &mut R, l: &[G::ScalarField], n: &[G::ScalarField], ) -> (G::ScalarField, G)
Generates random v and returns pair (v, v*g + <g_vec, n> + <h_vec, l>)
pub fn get_pedersen_commitment_key(&self) -> (G, G)
Trait Implementations§
Source§impl<G: AffineRepr> CanonicalDeserialize for SetupParams<G>
impl<G: AffineRepr> CanonicalDeserialize for SetupParams<G>
Source§fn deserialize_with_mode<R: Read>(
reader: R,
compress: Compress,
validate: Validate,
) -> Result<Self, SerializationError>
fn deserialize_with_mode<R: Read>( reader: R, compress: Compress, validate: Validate, ) -> Result<Self, SerializationError>
The general deserialize method that takes in customization flags.
fn deserialize_compressed<R>(reader: R) -> Result<Self, SerializationError>where
R: Read,
fn deserialize_compressed_unchecked<R>(
reader: R,
) -> Result<Self, SerializationError>where
R: Read,
fn deserialize_uncompressed<R>(reader: R) -> Result<Self, SerializationError>where
R: Read,
fn deserialize_uncompressed_unchecked<R>(
reader: R,
) -> Result<Self, SerializationError>where
R: Read,
Source§impl<G: AffineRepr> CanonicalSerialize for SetupParams<G>
impl<G: AffineRepr> CanonicalSerialize for SetupParams<G>
Source§fn serialize_with_mode<W: Write>(
&self,
writer: W,
compress: Compress,
) -> Result<(), SerializationError>
fn serialize_with_mode<W: Write>( &self, writer: W, compress: Compress, ) -> Result<(), SerializationError>
The general serialize method that takes in customization flags.
fn serialized_size(&self, compress: Compress) -> usize
fn serialize_compressed<W>(&self, writer: W) -> Result<(), SerializationError>where
W: Write,
fn compressed_size(&self) -> usize
fn serialize_uncompressed<W>(&self, writer: W) -> Result<(), SerializationError>where
W: Write,
fn uncompressed_size(&self) -> usize
Source§impl<G: Clone + AffineRepr> Clone for SetupParams<G>
impl<G: Clone + AffineRepr> Clone for SetupParams<G>
Source§fn clone(&self) -> SetupParams<G>
fn clone(&self) -> SetupParams<G>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<G: Debug + AffineRepr> Debug for SetupParams<G>
impl<G: Debug + AffineRepr> Debug for SetupParams<G>
Source§impl<G: PartialEq + AffineRepr> PartialEq for SetupParams<G>
impl<G: PartialEq + AffineRepr> PartialEq for SetupParams<G>
Source§impl<G: AffineRepr> Valid for SetupParams<G>
impl<G: AffineRepr> Valid for SetupParams<G>
fn check(&self) -> Result<(), SerializationError>
fn batch_check<'a>(
batch: impl Iterator<Item = &'a Self> + Send,
) -> Result<(), SerializationError>where
Self: 'a,
impl<G: Eq + AffineRepr> Eq for SetupParams<G>
impl<G: AffineRepr> StructuralPartialEq for SetupParams<G>
Auto Trait Implementations§
impl<G> Freeze for SetupParams<G>where
G: Freeze,
impl<G> RefUnwindSafe for SetupParams<G>where
G: RefUnwindSafe,
impl<G> Send for SetupParams<G>
impl<G> Sync for SetupParams<G>
impl<G> Unpin for SetupParams<G>where
G: Unpin,
impl<G> UnwindSafe for SetupParams<G>where
G: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more