aboutsummaryrefslogtreecommitdiff
path: root/schnorr/schnorr_test.go
diff options
context:
space:
mode:
authorÖzgür Kesim <oec@codeblau.de>2024-11-21 17:13:47 +0100
committerÖzgür Kesim <oec@codeblau.de>2024-11-21 17:13:47 +0100
commit0ada8c47427bfe604024d383ed7a250b04c82fee (patch)
tree4bc5e6432512a8060308413d303b675b0658bd1b /schnorr/schnorr_test.go
parent32cee46e39527a09504615b822cc61969c46184d (diff)
refactor: lifted nizk/ up and awayHEADwip
Diffstat (limited to 'schnorr/schnorr_test.go')
-rw-r--r--schnorr/schnorr_test.go34
1 files changed, 34 insertions, 0 deletions
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!")
+ }
+}