jf_plonk/transcript/
standard.rsuse super::PlonkTranscript;
use crate::errors::PlonkError;
use ark_ec::pairing::Pairing;
use ark_ff::PrimeField;
use merlin::Transcript;
pub struct StandardTranscript(Transcript);
impl<F> PlonkTranscript<F> for StandardTranscript {
fn new(label: &'static [u8]) -> Self {
Self(Transcript::new(label))
}
fn append_message(&mut self, label: &'static [u8], msg: &[u8]) -> Result<(), PlonkError> {
self.0.append_message(label, msg);
Ok(())
}
fn get_challenge<E>(&mut self, label: &'static [u8]) -> Result<E::ScalarField, PlonkError>
where
E: Pairing,
{
let mut buf = [0u8; 64];
self.0.challenge_bytes(label, &mut buf);
let challenge = E::ScalarField::from_le_bytes_mod_order(&buf);
Ok(challenge)
}
}