pub fn from_bytes(slice: &[u8]) -> Result<InnerProductProof, RangeProofError> {
        let b = slice.len();
        if b % 32 != 0 {
            return Err(RangeProofError::Format);
        }
        let num_elements = b / 32;
        if num_elements < 2 {
            return Err(RangeProofError::Format);
        }
        if (num_elements - 2) % 2 != 0 {
            return Err(RangeProofError::Format);
        }
        let lg_n = (num_elements - 2) / 2;
        if lg_n >= 32 {
            return Err(RangeProofError::Format);
        }

        let mut L_vec: Vec<CompressedRistretto> = Vec::with_capacity(lg_n);
        let mut R_vec: Vec<CompressedRistretto> = Vec::with_capacity(lg_n);
        for i in 0..lg_n {
            let pos = 2 * i * 32;
            L_vec.push(CompressedRistretto(util::read32(&slice[pos..])));
            R_vec.push(CompressedRistretto(util::read32(&slice[pos + 32..])));
        }

        let pos = 2 * lg_n * 32;
        let a = Scalar::from_canonical_bytes(util::read32(&slice[pos..]))
            .ok_or(RangeProofError::Format)?;
        let b = Scalar::from_canonical_bytes(util::read32(&slice[pos + 32..]))
            .ok_or(RangeProofError::Format)?;

        Ok(InnerProductProof { L_vec, R_vec, a, b })
    }
/// 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.
Deserializes the proof from a byte slice.
Deserializes the proof from a byte slice .
pub fn from_bytes(slice: &[u8]) -> Result<InnerProductProof, RangeProofError> {
        let b = slice.len();
        if b % 32 != 0 {
            return Err(RangeProofError::Format);
        }
        let num_elements = b / 32;
        if num_elements < 2 {
            return Err(RangeProofError::Format);
        }
        if (num_elements - 2) % 2 != 0 {
            return Err(RangeProofError::Format);
        }
        let lg_n = (num_elements - 2) / 2;
        if lg_n >= 32 {
            return Err(RangeProofError::Format);
        }
        let mut L_vec: Vec<CompressedRistretto> = Vec::with_capacity(lg_n);
        let mut R_vec: Vec<CompressedRistretto> = Vec::with_capacity(lg_n);
        for i in 0..lg_n {
            let pos = 2 * i * 32;
            L_vec.push(CompressedRistretto(util::read32(&slice[pos..])));
            R_vec.push(CompressedRistretto(util::read32(&slice[pos + 32..])));
        }
        let pos = 2 * lg_n * 32;
        let a = Scalar::from_canonical_bytes(util::read32(&slice[pos..]))
            .ok_or(RangeProofError::Format)?;
        let b = Scalar::from_canonical_bytes(util::read32(&slice[pos + 32..]))
            .ok_or(RangeProofError::Format)?;
        Ok(InnerProductProof { L_vec, R_vec, a, b })
    }
pub fn from_bytes ( slice : & [ u8 ] ) -> Result < InnerProductProof , RangeProofError > { let b = slice . len ( ) ; if b % 32 != 0 { return Err ( RangeProofError :: Format ) ; } let num_elements = b / 32 ; if num_elements < 2 { return Err ( RangeProofError :: Format ) ; } if ( num_elements - 2 ) % 2 != 0 { return Err ( RangeProofError :: Format ) ; } let lg_n = ( num_elements - 2 ) / 2 ; if lg_n >= 32 { return Err ( RangeProofError :: Format ) ; } let mut L_vec : Vec < CompressedRistretto > = Vec :: with_capacity ( lg_n ) ; let mut R_vec : Vec < CompressedRistretto > = Vec :: with_capacity ( lg_n ) ; for i in 0 .. lg_n { let pos = 2 * i * 32 ; L_vec . push ( CompressedRistretto ( util :: read32 ( & slice [ pos .. ] ) ) ) ; R_vec . push ( CompressedRistretto ( util :: read32 ( & slice [ pos + 32 .. ] ) ) ) ; } let pos = 2 * lg_n * 32 ; let a = Scalar :: from_canonical_bytes ( util :: read32 ( & slice [ pos .. ] ) ) . ok_or ( RangeProofError :: Format ) ? ; let b = Scalar :: from_canonical_bytes ( util :: read32 ( & slice [ pos + 32 .. ] ) ) . ok_or ( RangeProofError :: Format ) ? ; Ok ( InnerProductProof { L_vec , R_vec , a , b } ) }
Deserializes the proof from a byte slice.
Deserializes the proof from a byte slice .
slice
&[u8]