[][src]Struct bulletproofs::inner_product_proof::InnerProductProof

pub struct InnerProductProof {
    pub(crate) L_vec: Vec<CompressedRistretto>,
    pub(crate) R_vec: Vec<CompressedRistretto>,
    pub(crate) a: Scalar,
    pub(crate) b: Scalar,
}

Fields

L_vec: Vec<CompressedRistretto>R_vec: Vec<CompressedRistretto>a: Scalarb: Scalar

Methods

impl InnerProductProof[src]

pub fn create(
    transcript: &mut Transcript,
    Q: &RistrettoPoint,
    Hprime_factors: &[Scalar],
    G_vec: Vec<RistrettoPoint>,
    H_vec: Vec<RistrettoPoint>,
    a_vec: Vec<Scalar>,
    b_vec: Vec<Scalar>
) -> InnerProductProof
[src]

Create an inner-product proof.

The proof is created with respect to the bases \(G\), \(H'\), where \(H'_i = H_i \cdot \texttt{Hprime\_factors}_i\).

The verifier is passed in as a parameter so that the challenges depend on the entire transcript (including parent protocols).

The lengths of the vectors must all be the same, and must all be either 0 or a power of 2.

pub(crate) fn verification_scalars(
    &self,
    n: usize,
    transcript: &mut Transcript
) -> Result<(Vec<Scalar>, Vec<Scalar>, Vec<Scalar>), ProofError>
[src]

Computes three vectors of verification scalars \([u_{i}^{2}]\), \([u_{i}^{-2}]\) and \([s_{i}]\) for combined multiscalar multiplication in a parent protocol. See inner product protocol notes for details. The verifier must provide the input length \(n\) explicitly to avoid unbounded allocation within the inner product proof.

pub fn verify<I>(
    &self,
    n: usize,
    transcript: &mut Transcript,
    Hprime_factors: I,
    P: &RistrettoPoint,
    Q: &RistrettoPoint,
    G: &[RistrettoPoint],
    H: &[RistrettoPoint]
) -> Result<(), ProofError> where
    I: IntoIterator,
    I::Item: Borrow<Scalar>, 
[src]

This method is for testing that proof generation work, but for efficiency the actual protocols would use verification_scalars method to combine inner product verification with other checks in a single multiscalar multiplication.

pub fn serialized_size(&self) -> usize[src]

Returns the size in bytes required to serialize the inner product proof.

For vectors of length n the proof size is \(32 \cdot (2\lg n+2)\) bytes.

pub fn to_bytes(&self) -> Vec<u8>[src]

Serializes the proof into a byte array of \(2n+2\) 32-byte elements. The layout of the inner product proof is:

  • \(n\) pairs of compressed Ristretto points \(L_0, R_0 \dots, L_{n-1}, R_{n-1}\),
  • two scalars \(a, b\).

pub fn from_bytes(slice: &[u8]) -> Result<InnerProductProof, ProofError>[src]

Deserializes the proof from a byte slice. Returns an error in the following cases:

  • the slice does not have \(2n+2\) 32-byte elements,
  • \(n\) is larger or equal to 32 (proof is too big),
  • any of \(2n\) points are not valid compressed Ristretto points,
  • any of 2 scalars are not canonical scalars modulo Ristretto group order.

Trait Implementations

impl Clone for InnerProductProof[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for InnerProductProof[src]

Auto Trait Implementations

impl Send for InnerProductProof

impl Sync for InnerProductProof

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Same for T

type Output = T

Should always be Self