pub struct RangeProof(/* private fields */);Expand description
Bulletproof Range Proofs
Implementations§
Source§impl RangeProof
impl RangeProof
Sourcepub fn prove(
value: u64,
blinding: &Blinding,
range: &Range,
rng: &mut impl AllowedRng,
) -> FastCryptoResult<RangeProof>
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.
Sourcepub fn verify(
&self,
commitment: &PedersenCommitment,
range: &Range,
rng: &mut impl AllowedRng,
) -> FastCryptoResult<()>
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.
Sourcepub fn prove_batch(
values: &[u64],
blindings: &[Blinding],
range: &Range,
rng: &mut impl AllowedRng,
) -> FastCryptoResult<RangeProof>
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
valuesare not in the range. values.len() != blindings.len(),values.len()is not a power of 2,
Sourcepub fn verify_batch(
&self,
commitments: &[PedersenCommitment],
range: &Range,
rng: &mut impl AllowedRng,
) -> FastCryptoResult<()>
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.
Sourcepub fn to_bytes(&self) -> Vec<u8> ⓘ
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.
Sourcepub fn from_bytes(bytes: &[u8]) -> FastCryptoResult<Self>
pub fn from_bytes(bytes: &[u8]) -> FastCryptoResult<Self>
Deserialize a range proof. See also Self::to_bytes.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RangeProof
impl RefUnwindSafe for RangeProof
impl Send for RangeProof
impl Sync for RangeProof
impl Unpin for RangeProof
impl UnsafeUnpin for RangeProof
impl UnwindSafe for RangeProof
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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