pub fn rewind<C: Verification>(
        &self,
        secp: &Secp256k1<C>,
        commitment: PedersenCommitment,
        sk: SecretKey,
        additional_commitment: &[u8],
        additional_generator: Generator,
    ) -> Result<(Opening, Range<u64>), Error> {
        let mut min_value = 0u64;
        let mut max_value = 0u64;

        let mut blinding_factor = [0u8; 32];
        let mut value = 0u64;
        let mut message = [0u8; 4096];
        let mut message_length = 4096usize;

        let ret = unsafe {
            ffi::secp256k1_rangeproof_rewind(
                *secp.ctx(),
                blinding_factor.as_mut_ptr(),
                &mut value,
                message.as_mut_ptr(),
                &mut message_length,
                sk.as_ptr(),
                &mut min_value,
                &mut max_value,
                commitment.as_inner(),
                self.inner.as_ptr(),
                self.inner.len(),
                additional_commitment.as_ptr(),
                additional_commitment.len(),
                additional_generator.as_inner(),
            )
        };

        if ret == 0 {
            return Err(Error::InvalidRangeProof);
        }

        let opening = Opening {
            value,
            blinding_factor: Tweak::from_slice(&blinding_factor)?,
            message: message[..message_length].into(),
        };

        let range = Range {
            start: min_value,
            end: max_value + 1,
        };

        Ok((opening, range))
    }
/// Verify a range proof proof and rewind the proof to recover information sent by its author.
Verify a range proof proof and rewind the proof to recover information sent by its author.
Verify a range proof proof and rewind the proof to recover information sent by its author .
pub fn rewind<C: Verification>(
        &self,
        secp: &Secp256k1<C>,
        commitment: PedersenCommitment,
        sk: SecretKey,
        additional_commitment: &[u8],
        additional_generator: Generator,
    ) -> Result<(Opening, Range<u64>), Error> {
        let mut min_value = 0u64;
        let mut max_value = 0u64;
        let mut blinding_factor = [0u8; 32];
        let mut value = 0u64;
        let mut message = [0u8; 4096];
        let mut message_length = 4096usize;
        let ret = unsafe {
            ffi::secp256k1_rangeproof_rewind(
                *secp.ctx(),
                blinding_factor.as_mut_ptr(),
                &mut value,
                message.as_mut_ptr(),
                &mut message_length,
                sk.as_ptr(),
                &mut min_value,
                &mut max_value,
                commitment.as_inner(),
                self.inner.as_ptr(),
                self.inner.len(),
                additional_commitment.as_ptr(),
                additional_commitment.len(),
                additional_generator.as_inner(),
            )
        };
        if ret == 0 {
            return Err(Error::InvalidRangeProof);
        }
        let opening = Opening {
            value,
            blinding_factor: Tweak::from_slice(&blinding_factor)?,
            message: message[..message_length].into(),
        };
        let range = Range {
            start: min_value,
            end: max_value + 1,
        };
        Ok((opening, range))
    }
pub fn rewind < C : Verification > ( & self , secp : & Secp256k1 < C > , commitment : PedersenCommitment , sk : SecretKey , additional_commitment : & [ u8 ] , additional_generator : Generator , ) -> Result < ( Opening , Range < u64 > ) , Error > { let mut min_value = 0u64 ; let mut max_value = 0u64 ; let mut blinding_factor = [ 0u8 ; 32 ] ; let mut value = 0u64 ; let mut message = [ 0u8 ; 4096 ] ; let mut message_length = 4096usize ; let ret = unsafe { ffi :: secp256k1_rangeproof_rewind ( * secp . ctx ( ) , blinding_factor . as_mut_ptr ( ) , & mut value , message . as_mut_ptr ( ) , & mut message_length , sk . as_ptr ( ) , & mut min_value , & mut max_value , commitment . as_inner ( ) , self . inner . as_ptr ( ) , self . inner . len ( ) , additional_commitment . as_ptr ( ) , additional_commitment . len ( ) , additional_generator . as_inner ( ) , ) } ; if ret == 0 { return Err ( Error :: InvalidRangeProof ) ; } let opening = Opening { value , blinding_factor : Tweak :: from_slice ( & blinding_factor ) ? , message : message [ .. message_length ] . into ( ) , } ; let range = Range { start : min_value , end : max_value + 1 , } ; Ok ( ( opening , range ) ) }
Verify a range proof proof and rewind the proof to recover information sent by its author.
Verify a range proof proof and rewind the proof to recover information sent by its author .
&self
secp
&Secp256k1<C>
commitment
PedersenCommitment
sk
SecretKey
additional_commitment
&[u8]
additional_generator
Generator
&self
secp
&Secp256k1<C>
commitment
PedersenCommitment
sk
SecretKey
additional_commitment
&[u8]
additional_generator
Generator