pub fn from_bytes(bytes: &[u8]) -> Option<Self> {
        if bytes.len() != 64 {
            return None;
        }

        let mut scalar_bytes = [0u8; 32];
        scalar_bytes.copy_from_slice(&bytes[..32]);
        let scalar = match Scalar::from_canonical_bytes(scalar_bytes) {
            Some(x) => x,
            None => return None,
        };
        let mut dk = [0u8; 32];
        dk.copy_from_slice(&bytes[32..]);
        let precompressed_pubkey = (scalar * &constants::RISTRETTO_BASEPOINT_POINT).compress();

        return Some(Xprv {
            scalar,
            dk,
            precompressed_pubkey,
        });
    }
/// Decodes an Xprv from a 64-byte array, and fails if the provided array is not
/// exactly 64 bytes.
Decodes an Xprv from a 64-byte array, and fails if the provided array is not
exactly 64 bytes.
Decodes an Xprv from a 64 - byte array and fails if the provided array is not exactly 64 bytes .
pub fn from_bytes(bytes: &[u8]) -> Option<Self> {
        if bytes.len() != 64 {
            return None;
        }
        let mut scalar_bytes = [0u8; 32];
        scalar_bytes.copy_from_slice(&bytes[..32]);
        let scalar = match Scalar::from_canonical_bytes(scalar_bytes) {
            Some(x) => x,
            None => return None,
        };
        let mut dk = [0u8; 32];
        dk.copy_from_slice(&bytes[32..]);
        let precompressed_pubkey = (scalar * &constants::RISTRETTO_BASEPOINT_POINT).compress();
        return Some(Xprv {
            scalar,
            dk,
            precompressed_pubkey,
        });
    }
pub fn from_bytes ( bytes : & [ u8 ] ) -> Option < Self > { if bytes . len ( ) != 64 { return None ; } let mut scalar_bytes = [ 0u8 ; 32 ] ; scalar_bytes . copy_from_slice ( & bytes [ .. 32 ] ) ; let scalar = match Scalar :: from_canonical_bytes ( scalar_bytes ) { Some ( x ) => x , None => return None , } ; let mut dk = [ 0u8 ; 32 ] ; dk . copy_from_slice ( & bytes [ 32 .. ] ) ; let precompressed_pubkey = ( scalar * & constants :: RISTRETTO_BASEPOINT_POINT ) . compress ( ) ; return Some ( Xprv { scalar , dk , precompressed_pubkey , } ) ; }
Decodes an Xprv from a 64-byte array, and fails if the provided array is not
exactly 64 bytes.
Decodes an Xprv from a 64 - byte array and fails if the provided array is not exactly 64 bytes .
bytes
&[u8]
bytes
&[u8]