[][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,
    G_factors: &[Scalar],
    H_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<IG, IH>(
    &self,
    n: usize,
    transcript: &mut Transcript,
    G_factors: IG,
    H_factors: IH,
    P: &RistrettoPoint,
    Q: &RistrettoPoint,
    G: &[RistrettoPoint],
    H: &[RistrettoPoint]
) -> Result<(), ProofError> where
    IG: IntoIterator,
    IG::Item: Borrow<Scalar>,
    IH: IntoIterator,
    IH::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]

impl Debug for InnerProductProof[src]

Auto Trait Implementations

impl RefUnwindSafe for InnerProductProof

impl Send for InnerProductProof

impl Sync for InnerProductProof

impl Unpin for InnerProductProof

impl UnwindSafe for InnerProductProof

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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

type Owned = T

The resulting type after obtaining ownership.

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

type Error = !

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.