/// Hash onto BLS12-381 G1 (random oracle variant) returning MIRACL object
///
/// This follows the internet draft <https://datatracker.ietf.org/doc/draft-irtf-cfrg-hash-to-curve/>
///
/// # Arguments
/// * `dst` is a domain separation tag (see draft-irtf-cfrg-hash-to-curve for
///   guidance on formatting of this tag)
/// * `msg` is the message to be hashed to an elliptic curve point on BLS12_381.
/// # Returns
/// The G1 point as a MIRACL object
Hash onto BLS12-381 G1 (random oracle variant) returning MIRACL object
This follows the internet draft
Hash onto BLS12 - 381 G1 ( random oracle variant ) returning MIRACL object This follows the internet draft
pub fn hash_to_miracl_g1(dst: &[u8], msg: &[u8]) -> MiraclG1 {
    use miracl_core::bls12381::ecp;
    use miracl_core::hmac;
    let u = hash_to_field_bls12381(hmac::MC_SHA2, ecp::HASH_TYPE, dst, msg, 2);
    // Note: `map2point` implements the function `map_to_curve` specified in the
    // internet draft, according to the BLS12_381 ciphersuite for G1.
    let mut p = MiraclG1::map2point(&u[0]);
    let p1 = MiraclG1::map2point(&u[1]);
    p.add(&p1);
    p.cfp();
    p.affine();
    p
}
pub fn hash_to_miracl_g1 ( dst : & [ u8 ] , msg : & [ u8 ] ) -> MiraclG1 { use miracl_core :: bls12381 :: ecp ; use miracl_core :: hmac ; let u = hash_to_field_bls12381 ( hmac :: MC_SHA2 , ecp :: HASH_TYPE , dst , msg , 2 ) ; // Note: `map2point` implements the function `map_to_curve` specified in the // internet draft, according to the BLS12_381 ciphersuite for G1. let mut p = MiraclG1 :: map2point ( & u [ 0 ] ) ; let p1 = MiraclG1 :: map2point ( & u [ 1 ] ) ; p . add ( & p1 ) ; p . cfp ( ) ; p . affine ( ) ; p }
Hash onto BLS12-381 G1 (random oracle variant) returning MIRACL object
This follows the internet draft <https://datatracker.ietf.org/doc/draft-irtf-cfrg-hash-to-curve/>
Hash onto BLS12 - 381 G1 ( random oracle variant ) returning MIRACL object This follows the internet draft <https : // datatracker . ietf . org / doc / draft - irtf - cfrg - hash - to - curve / >
The G1 point as a MIRACL object
The G1 point as a MIRACL object
dst
&[u8]
msg
&[u8]