aboutsummaryrefslogtreecommitdiff
path: root/nizk/commit/commit_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'nizk/commit/commit_test.go')
-rw-r--r--nizk/commit/commit_test.go19
1 files changed, 12 insertions, 7 deletions
diff --git a/nizk/commit/commit_test.go b/nizk/commit/commit_test.go
index 916ba0e..de5d22e 100644
--- a/nizk/commit/commit_test.go
+++ b/nizk/commit/commit_test.go
@@ -7,15 +7,20 @@ import (
)
func TestStatement(t *testing.T) {
- var α, β = Curve.RandomScalar(), Curve.RandomScalar()
+ var α, β, id = Curve.RandomScalar(), Curve.RandomScalar(), Curve.RandomScalar()
+
+ Id := G.Exp(id)
st1, st2 := NewStatement(α, β, true), NewStatement(α, β, false)
- c1, c2 := st1.Commit(), st2.Commit()
- pr1, pr2 := st1.Proof(), st2.Proof()
- if !c1.Verify(pr1) {
- t.Fatal("Could not verify st1 with c1 and pr1, plus=true case")
+ c1, c2 := st1.Commit(Id), st2.Commit(Id)
+ if !c1.Verify() {
+ t.Fatal("Could not verify st1 with c1, plus=true case")
+ }
+ if !c2.Verify() {
+ t.Fatal("Could not verify st2 with c2, plus=false case")
}
- if !c2.Verify(pr2) {
- t.Fatal("Could not verify st2 with c2 and pr2, plus=false case")
+ c2.Proof = c1.Proof
+ if c2.Verify() {
+ t.Fatal("Verify with wrong proof should have failed!")
}
}