mirror of
https://github.com/arnaucube/schnorr.git
synced 2026-01-12 17:01:29 +01:00
Make trait SignatureVerifierBuilder
This commit is contained in:
@@ -19,8 +19,6 @@ use crate::schnorr::{SchnorrPublicKey, SchnorrSignature};
|
|||||||
|
|
||||||
type GoldF = GoldilocksField;
|
type GoldF = GoldilocksField;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default)]
|
||||||
pub struct Mod65537Generator {
|
pub struct Mod65537Generator {
|
||||||
a: Target,
|
a: Target,
|
||||||
|
|||||||
@@ -78,8 +78,30 @@ impl SchnorrPublicKeyTarget {
|
|||||||
|
|
||||||
pub struct SchnorrBuilder {}
|
pub struct SchnorrBuilder {}
|
||||||
|
|
||||||
impl SchnorrBuilder {
|
pub trait SignatureVerifierBuilder {
|
||||||
pub fn constrain_sig <
|
fn constrain_sig <
|
||||||
|
C: GenericConfig<2, F = GoldF>,
|
||||||
|
> (
|
||||||
|
&self,
|
||||||
|
builder: &mut CircuitBuilder::<GoldF, 2>,
|
||||||
|
sig: &SchnorrSignatureTarget,
|
||||||
|
msg: &MessageTarget,
|
||||||
|
pk: &SchnorrPublicKeyTarget,
|
||||||
|
);
|
||||||
|
|
||||||
|
fn verify_sig <
|
||||||
|
C: GenericConfig<2, F = GoldF>,
|
||||||
|
> (
|
||||||
|
&self,
|
||||||
|
builder: &mut CircuitBuilder::<GoldF, 2>,
|
||||||
|
sig: &SchnorrSignatureTarget,
|
||||||
|
msg: &MessageTarget,
|
||||||
|
pk: &SchnorrPublicKeyTarget,
|
||||||
|
) -> BoolTarget;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl SignatureVerifierBuilder for SchnorrBuilder {
|
||||||
|
fn constrain_sig <
|
||||||
C: GenericConfig<2, F = GoldF>,
|
C: GenericConfig<2, F = GoldF>,
|
||||||
> (
|
> (
|
||||||
&self,
|
&self,
|
||||||
@@ -93,7 +115,7 @@ impl SchnorrBuilder {
|
|||||||
builder.connect(verification_output.target, true_target.target);
|
builder.connect(verification_output.target, true_target.target);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn verify_sig <
|
fn verify_sig <
|
||||||
C: GenericConfig<2, F = GoldF>,
|
C: GenericConfig<2, F = GoldF>,
|
||||||
> (
|
> (
|
||||||
&self,
|
&self,
|
||||||
|
|||||||
Reference in New Issue
Block a user