/// Parses a `G1` in a standard, library-independent form to a MIRACL `ECP`.
///
/// Also verifies that the point is in the correct prime order subgroup.
///
/// # Errors
/// * `Err(())` if
///   - The point is *not* in the correct prime order subgroup.
///   - The point is encoded in UNCOMPRESSED form
///   - The point's x-coordinate is non-canonical (i.e. greater than the field
///     modulus)
///   - The point's x-coordinate is infinity, but the INFINITY flag is *not* set
///   - The INFINITY flag is set, but the encoded x-coordinate is *not*
///     all-zeroes
Parses a `G1` in a standard, library-independent form to a MIRACL `ECP`.
Also verifies that the point is in the correct prime order subgroup.
Parses a ` G1 ` in a standard library - independent form to a MIRACL ` ECP ` . Also verifies that the point is in the correct prime order subgroup .
pub fn miracl_g1_from_bytes(bytes: &[u8; G1Bytes::SIZE]) -> Result<ECP, ()> {
    let ans = miracl_g1_from_bytes_unchecked(bytes)?;
    {
        // Verify that the point has the expected degree:
        let spec_p = BIG::new_ints(&CURVE_ORDER);
        if !ans.mul(&spec_p).is_infinity() {
            return Err(());
        }
    }
    Ok(ans)
}
pub fn miracl_g1_from_bytes ( bytes : & [ u8 ; G1Bytes :: SIZE ] ) -> Result < ECP , ( ) > { let ans = miracl_g1_from_bytes_unchecked ( bytes ) ? ; { // Verify that the point has the expected degree: let spec_p = BIG :: new_ints ( & CURVE_ORDER ) ; if ! ans . mul ( & spec_p ) . is_infinity ( ) { return Err ( ( ) ) ; } } Ok ( ans ) }
Parses a `G1` in a standard, library-independent form to a MIRACL `ECP`.
Parses a ` G1 ` in a standard library - independent form to a MIRACL ` ECP ` .
bytes
&[u8; G1Bytes::SIZE]
errors
`Err(())` if
The point is *not* in the correct prime order subgroup.
The point is encoded in UNCOMPRESSED form
The point's x-coordinate is non-canonical
The point's x-coordinate is infinity, but the INFINITY flag is *not* set
The INFINITY flag is set, but the encoded x-coordinate is *not
all-zeroes
` Err (( )) ` if The point is * not * in the correct prime order subgroup . The point is encoded in UNCOMPRESSED form The point ' s x - coordinate is non - canonical The point ' s x - coordinate is infinity but the INFINITY flag is * not * set The INFINITY flag is set but the encoded x - coordinate is * not all - zeroes