use super::*;
use k256::{
elliptic_curve::{
hash2curve::{ExpandMsgXmd, GroupDigest},
sec1::ToEncodedPoint,
},
ProjectivePoint, Secp256k1,
};
pub(crate) fn hash_to_curve(
m: &[u8],
pk: &ProjectivePoint,
) -> Result<ProjectivePoint, k256::elliptic_curve::Error> {
Secp256k1::hash_from_bytes::<ExpandMsgXmd<Sha256>>(
&[[m, &encode_pt(pk)].concat().as_slice()],
&[DST],
)
}
pub(crate) fn encode_pt(point: &ProjectivePoint) -> Vec<u8> {
point.to_encoded_point(true).to_bytes().to_vec()
}