bp_pp/
transcript.rs

1use k256::{FieldBytes, ProjectivePoint, Scalar};
2use k256::elliptic_curve::group::GroupEncoding;
3use k256::elliptic_curve::PrimeField;
4use merlin::Transcript;
5
6pub fn app_point(label: &'static [u8], p: &ProjectivePoint, t: &mut Transcript) {
7    t.append_message(label, p.to_bytes().as_slice());
8}
9
10pub fn get_challenge(label: &'static [u8], t: &mut Transcript) -> Scalar {
11    let mut buf = [0u8; 32];
12    t.challenge_bytes(label, &mut buf);
13    Scalar::from_repr(*FieldBytes::from_slice(&buf)).unwrap()
14}