forked from dalek-cryptography/merlin
-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Description
We need to add a couple samples to help people see how Merlin is used. I just had a conversation with David Vorick who said those examples really help make sense of Merlin.
Example 1: hashing structured data
How HMAC(key, data) would look like on a structured data:
t = Transcript::new(b"Example domain");
t.append_bytes(b"key", b"secretpassword");
t.append_bytes(b"name", b"Merlin");
t.append_bytes(b"job", b"Magic");
hash = t.challenge_bytes(32);Example 2: use in a ZKP protocol
t = Transcript::new(b"My protocol");
...
t.append_bytes(b"message", ...);
...
t.append_bytes(b"domain-separator", "schnorr-v1");
t.append_bytes(b"X", pubkey.as_point());
t.append_point(b"R", &self.R);
challenge = t.challenge_scalar(b"c");
...Example 3: generating randomness with TranscriptRNG
...TrevorGKann and DougAnderson444
Metadata
Metadata
Assignees
Labels
No labels