Open devloper opened 4 months ago
Been looking into this, and studying existing libraries, there are two possible conclusions, either implement a byte-oriented transcript based on Keccak or Blake3 (or other byte-oriented hash functions).
trait Hasher {
fn hash(&mut self, &[u8], buf: &mut [u8]);
}
pub struct Transcript<H: Hasher> {
state: Vec<u8>,
}
impl Transcript {
fn add_message(&mut self, message: &[u8]);
fn create_challenge(&self, buf: &mut [u8]);
}
pub trait ByteHandler<C> {
fn from_bytes(bytes: &[u8]) -> C;
fn to_bytes(c: &C, buf: &mut [u8]);
}
or a field-oriented based on algebraic hash functions like Poseidon. Maybe use SAFE API for designing the sponge.
Need inputs of which way do you think is more suitable for a universal transcript. Am i missing something, or is there any other way you think this can be implemented?
universal transcript, support for various hashing techniques.