pub struct RangeProof { /* private fields */ }Available on crate feature
std only.Expand description
Represents a range proof.
TODO: Store rangeproof info
Implementations§
Source§impl RangeProof
impl RangeProof
Sourcepub fn from_slice(bytes: &[u8]) -> Result<Self, Error>
pub fn from_slice(bytes: &[u8]) -> Result<Self, Error>
Parse from byte slice.
TODO: Rename to parse (and other similar functions)
Sourcepub fn new<C: Signing>(
secp: &Secp256k1<C>,
min_value: u64,
commitment: PedersenCommitment,
value: u64,
commitment_blinding: Tweak,
message: &[u8],
additional_commitment: &[u8],
sk: SecretKey,
exp: i32,
min_bits: u8,
additional_generator: Generator,
) -> Result<RangeProof, Error>
pub fn new<C: Signing>( secp: &Secp256k1<C>, min_value: u64, commitment: PedersenCommitment, value: u64, commitment_blinding: Tweak, message: &[u8], additional_commitment: &[u8], sk: SecretKey, exp: i32, min_bits: u8, additional_generator: Generator, ) -> Result<RangeProof, Error>
Prove that commitment hides a value within a range, with the lower bound set to min_value.
Sourcepub fn verify<C: Verification>(
&self,
secp: &Secp256k1<C>,
commitment: PedersenCommitment,
additional_commitment: &[u8],
additional_generator: Generator,
) -> Result<Range<u64>, Error>
pub fn verify<C: Verification>( &self, secp: &Secp256k1<C>, commitment: PedersenCommitment, additional_commitment: &[u8], additional_generator: Generator, ) -> Result<Range<u64>, Error>
Verify that the committed value is within a range.
If the verification is successful, return the actual range of possible values.
Sourcepub fn rewind<C: Verification>(
&self,
secp: &Secp256k1<C>,
commitment: PedersenCommitment,
sk: SecretKey,
additional_commitment: &[u8],
additional_generator: Generator,
) -> Result<(Opening, Range<u64>), Error>
pub fn rewind<C: Verification>( &self, secp: &Secp256k1<C>, commitment: PedersenCommitment, sk: SecretKey, additional_commitment: &[u8], additional_generator: Generator, ) -> Result<(Opening, Range<u64>), Error>
Verify a range proof proof and rewind the proof to recover information sent by its author.
Trait Implementations§
Source§impl Clone for RangeProof
impl Clone for RangeProof
Source§fn clone(&self) -> RangeProof
fn clone(&self) -> RangeProof
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 Debug for RangeProof
impl Debug for RangeProof
Source§impl<'de> Deserialize<'de> for RangeProof
Available on crate features serde and hashes only.
impl<'de> Deserialize<'de> for RangeProof
Available on crate features
serde and hashes only.Source§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<RangeProof, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<RangeProof, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for RangeProof
Available on crate feature hashes only.
impl Display for RangeProof
Available on crate feature
hashes only.Source§impl FromStr for RangeProof
impl FromStr for RangeProof
Source§impl Hash for RangeProof
impl Hash for RangeProof
Source§impl Ord for RangeProof
impl Ord for RangeProof
Source§fn cmp(&self, other: &RangeProof) -> Ordering
fn cmp(&self, other: &RangeProof) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for RangeProof
impl PartialEq for RangeProof
Source§impl PartialOrd for RangeProof
impl PartialOrd for RangeProof
Source§impl Serialize for RangeProof
Available on crate features serde and hashes only.
impl Serialize for RangeProof
Available on crate features
serde and hashes only.impl Eq for RangeProof
impl StructuralPartialEq for RangeProof
Auto Trait Implementations§
impl Freeze for RangeProof
impl RefUnwindSafe for RangeProof
impl Send for RangeProof
impl Sync for RangeProof
impl Unpin 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
Mutably borrows from an owned value. Read more