pub fn hash_g2<M: AsRef<[u8]>>(msg: M) -> G2ProjectiveExpand description
Returns a hash of the given message in G2 using the standard hash-to-curve
algorithm (RFC 9380 / draft-irtf-cfrg-hash-to-curve).
This implementation uses the recommended domain separation tag and provides proper security properties required for BLS signatures.
This function is useful when you need to pre-hash a message for use with
PublicKey::verify_g2 or SecretKey::sign_g2, or when implementing
custom signature schemes.
ยงExample
use threshold_pairing::{hash_g2, SecretKey};
let sk = SecretKey::random();
let pk = sk.public_key();
let message = b"Hello, world!";
let hash = hash_g2(message);
// Sign using the pre-computed hash
let sig = sk.sign_g2(hash);
// Verify using the same hash
assert!(pk.verify_g2(&sig, hash));