Skip to main content

RangeProof

Struct RangeProof 

Source
pub struct RangeProof(/* private fields */);
Expand description

Bulletproof Range Proofs

Implementations§

Source§

impl RangeProof

Source

pub fn prove( value: u64, blinding: &Blinding, range: &Range, rng: &mut impl AllowedRng, ) -> FastCryptoResult<RangeProof>

Prove that the value is in the given range using the given commitment blinding. This enables creating proofs for an existing commitment. Returns an InvalidInput error if the value is not in range.

Source

pub fn verify( &self, commitment: &PedersenCommitment, range: &Range, rng: &mut impl AllowedRng, ) -> FastCryptoResult<()>

Verifies a range proof: That the commitment is to a value in the given range.

Source

pub fn prove_batch( values: &[u64], blindings: &[Blinding], range: &Range, rng: &mut impl AllowedRng, ) -> FastCryptoResult<RangeProof>

Create a proof that all the given values are in the range using the given commitment blindings. This enables creating proofs for existing commitments.

Fails if

  • any of the values are not in the range.
  • values.len() != blindings.len(),
  • values.len() is not a power of 2,
Source

pub fn verify_batch( &self, commitments: &[PedersenCommitment], range: &Range, rng: &mut impl AllowedRng, ) -> FastCryptoResult<()>

Verifies that a range proof that all commitments are to values in the given range.

Source

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

Serialize a range proof. The output will be serialized Risretto255 group elements and scalars. It follows the format used in https://github.com/dalek-cryptography/bulletproofs/blob/be67b6d5f5ad1c1f54d5511b52e6d645a1313d07/src/range_proof/mod.rs#L59-L76.

Source

pub fn from_bytes(bytes: &[u8]) -> FastCryptoResult<Self>

Deserialize a range proof. See also Self::to_bytes.

Trait Implementations§

Source§

impl Debug for RangeProof

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V