pub fn from_uncompressed_unchecked(bytes: &[u8; 192]) -> CtOption<Self> {
        // Obtain the three flags from the start of the byte sequence
        let compression_flag_set = Choice::from((bytes[0] >> 7) & 1);
        let infinity_flag_set = Choice::from((bytes[0] >> 6) & 1);
        let sort_flag_set = Choice::from((bytes[0] >> 5) & 1);

        // Attempt to obtain the x-coordinate
        let xc1 = {
            let mut tmp = [0; 48];
            tmp.copy_from_slice(&bytes[0..48]);

            // Mask away the flag bits
            tmp[0] &= 0b0001_1111;

            Fp::from_bytes(&tmp)
        };
        let xc0 = {
            let mut tmp = [0; 48];
            tmp.copy_from_slice(&bytes[48..96]);

            Fp::from_bytes(&tmp)
        };

        // Attempt to obtain the y-coordinate
        let yc1 = {
            let mut tmp = [0; 48];
            tmp.copy_from_slice(&bytes[96..144]);

            Fp::from_bytes(&tmp)
        };
        let yc0 = {
            let mut tmp = [0; 48];
            tmp.copy_from_slice(&bytes[144..192]);

            Fp::from_bytes(&tmp)
        };

        xc1.and_then(|xc1| {
            xc0.and_then(|xc0| {
                yc1.and_then(|yc1| {
                    yc0.and_then(|yc0| {
                        let x = Fp2 {
                            c0: xc0,
                            c1: xc1
                        };
                        let y = Fp2 {
                            c0: yc0,
                            c1: yc1
                        };

                        // Create a point representing this value
                        let p = G2Affine::conditional_select(
                            &G2Affine {
                                x,
                                y,
                                infinity: infinity_flag_set,
                            },
                            &G2Affine::identity(),
                            infinity_flag_set,
                        );

                        CtOption::new(
                            p,
                            // If the infinity flag is set, the x and y coordinates should have been zero.
                            ((!infinity_flag_set) | (infinity_flag_set & x.is_zero() & y.is_zero())) &
                            // The compression flag should not have been set, as this is an uncompressed element
                            (!compression_flag_set) &
                            // The sort flag should not have been set, as this is an uncompressed element
                            (!sort_flag_set),
                        )
                    })
                })
            })
        })
    }
/// Attempts to deserialize an uncompressed element, not checking if the
/// element is on the curve and not checking if it is in the correct subgroup.
/// **This is dangerous to call unless you trust the bytes you are reading; otherwise,
/// API invariants may be broken.** Please consider using `from_uncompressed()` instead.
Attempts to deserialize an uncompressed element, not checking if the
element is on the curve and not checking if it is in the correct subgroup.
This is dangerous to call unless you trust the bytes you are reading; otherwise,
API invariants may be broken.** Please consider using `from_uncompressed()` instead.
Attempts to deserialize an uncompressed element not checking if the element is on the curve and not checking if it is in the correct subgroup . This is dangerous to call unless you trust the bytes you are reading ; otherwise API invariants may be broken . ** Please consider using ` from_uncompressed () ` instead .
pub fn from_uncompressed_unchecked(bytes: &[u8; 192]) -> CtOption<Self> {
        // Obtain the three flags from the start of the byte sequence
        let compression_flag_set = Choice::from((bytes[0] >> 7) & 1);
        let infinity_flag_set = Choice::from((bytes[0] >> 6) & 1);
        let sort_flag_set = Choice::from((bytes[0] >> 5) & 1);
        // Attempt to obtain the x-coordinate
        let xc1 = {
            let mut tmp = [0; 48];
            tmp.copy_from_slice(&bytes[0..48]);
            // Mask away the flag bits
            tmp[0] &= 0b0001_1111;
            Fp::from_bytes(&tmp)
        };
        let xc0 = {
            let mut tmp = [0; 48];
            tmp.copy_from_slice(&bytes[48..96]);
            Fp::from_bytes(&tmp)
        };
        // Attempt to obtain the y-coordinate
        let yc1 = {
            let mut tmp = [0; 48];
            tmp.copy_from_slice(&bytes[96..144]);
            Fp::from_bytes(&tmp)
        };
        let yc0 = {
            let mut tmp = [0; 48];
            tmp.copy_from_slice(&bytes[144..192]);
            Fp::from_bytes(&tmp)
        };
        xc1.and_then(|xc1| {
            xc0.and_then(|xc0| {
                yc1.and_then(|yc1| {
                    yc0.and_then(|yc0| {
                        let x = Fp2 {
                            c0: xc0,
                            c1: xc1
                        };
                        let y = Fp2 {
                            c0: yc0,
                            c1: yc1
                        };
                        // Create a point representing this value
                        let p = G2Affine::conditional_select(
                            &G2Affine {
                                x,
                                y,
                                infinity: infinity_flag_set,
                            },
                            &G2Affine::identity(),
                            infinity_flag_set,
                        );
                        CtOption::new(
                            p,
                            // If the infinity flag is set, the x and y coordinates should have been zero.
                            ((!infinity_flag_set) | (infinity_flag_set & x.is_zero() & y.is_zero())) &
                            // The compression flag should not have been set, as this is an uncompressed element
                            (!compression_flag_set) &
                            // The sort flag should not have been set, as this is an uncompressed element
                            (!sort_flag_set),
                        )
                    })
                })
            })
        })
    }
pub fn from_uncompressed_unchecked ( bytes : & [ u8 ; 192 ] ) -> CtOption < Self > { // Obtain the three flags from the start of the byte sequence let compression_flag_set = Choice :: from ( ( bytes [ 0 ] >> 7 ) & 1 ) ; let infinity_flag_set = Choice :: from ( ( bytes [ 0 ] >> 6 ) & 1 ) ; let sort_flag_set = Choice :: from ( ( bytes [ 0 ] >> 5 ) & 1 ) ; // Attempt to obtain the x-coordinate let xc1 = { let mut tmp = [ 0 ; 48 ] ; tmp . copy_from_slice ( & bytes [ 0 .. 48 ] ) ; // Mask away the flag bits tmp [ 0 ] &= 0b0001_1111 ; Fp :: from_bytes ( & tmp ) } ; let xc0 = { let mut tmp = [ 0 ; 48 ] ; tmp . copy_from_slice ( & bytes [ 48 .. 96 ] ) ; Fp :: from_bytes ( & tmp ) } ; // Attempt to obtain the y-coordinate let yc1 = { let mut tmp = [ 0 ; 48 ] ; tmp . copy_from_slice ( & bytes [ 96 .. 144 ] ) ; Fp :: from_bytes ( & tmp ) } ; let yc0 = { let mut tmp = [ 0 ; 48 ] ; tmp . copy_from_slice ( & bytes [ 144 .. 192 ] ) ; Fp :: from_bytes ( & tmp ) } ; xc1 . and_then ( | xc1 | { xc0 . and_then ( | xc0 | { yc1 . and_then ( | yc1 | { yc0 . and_then ( | yc0 | { let x = Fp2 { c0 : xc0 , c1 : xc1 } ; let y = Fp2 { c0 : yc0 , c1 : yc1 } ; // Create a point representing this value let p = G2Affine :: conditional_select ( & G2Affine { x , y , infinity : infinity_flag_set , } , & G2Affine :: identity ( ) , infinity_flag_set , ) ; CtOption :: new ( p , // If the infinity flag is set, the x and y coordinates should have been zero. ( ( ! infinity_flag_set ) | ( infinity_flag_set & x . is_zero ( ) & y . is_zero ( ) ) ) & // The compression flag should not have been set, as this is an uncompressed element ( ! compression_flag_set ) & // The sort flag should not have been set, as this is an uncompressed element ( ! sort_flag_set ) , ) } ) } ) } ) } ) }
Attempts to deserialize an uncompressed element, not checking if the
element is on the curve and not checking if it is in the correct subgroup.
Attempts to deserialize an uncompressed element not checking if the element is on the curve and not checking if it is in the correct subgroup .
bytes
&[u8; 192]
bytes
&[u8; 192]