From 0ada8c47427bfe604024d383ed7a250b04c82fee Mon Sep 17 00:00:00 2001 From: Özgür Kesim Date: Thu, 21 Nov 2024 17:13:47 +0100 Subject: refactor: lifted nizk/ up and away --- schnorr/schnorr_test.go | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 schnorr/schnorr_test.go (limited to 'schnorr/schnorr_test.go') diff --git a/schnorr/schnorr_test.go b/schnorr/schnorr_test.go new file mode 100644 index 0000000..2adec8e --- /dev/null +++ b/schnorr/schnorr_test.go @@ -0,0 +1,34 @@ +package schnorr + +import ( + "testing" + + . "kesim.org/seal/common" +) + +func TestSchnorr(t *testing.T) { + a, e := Curve.ScalarFromReader(nil) + if e != nil { + t.Fatal(e) + } + A := G.Exp(a) + + id, e := Curve.ScalarFromReader(nil) + if e != nil { + t.Fatal(e) + } + ID := G.Exp(id) + + s := (*Statement)(a) + c := (*Commitment)(A) + + pr := s.Proof(ID) + + if !c.Verify(pr, ID) { + t.Fatalf("Verification failed!") + } + + if c.Verify(pr, ID.Exp(a)) { + t.Fatal("Verification didn't fail!") + } +} -- cgit v1.2.3