aboutsummaryrefslogtreecommitdiff
path: root/nizk/commit.go
diff options
context:
space:
mode:
Diffstat (limited to 'nizk/commit.go')
-rw-r--r--nizk/commit.go11
1 files changed, 4 insertions, 7 deletions
diff --git a/nizk/commit.go b/nizk/commit.go
index 5634b16..ecb1568 100644
--- a/nizk/commit.go
+++ b/nizk/commit.go
@@ -38,18 +38,19 @@ type Proof struct {
}
}
-func NewBit(id Bytes, set bool) *Bit {
+func NewBit(id Bytes, set bool) (*Bit, *Commitment, *Proof) {
α, β := Curve.RandomScalar(), Curve.RandomScalar()
return NewBitFromScalars(id, set, α, β)
}
-func NewBitFromScalars(id Bytes, set bool, α, β *Scalar) *Bit {
- return &Bit{
+func NewBitFromScalars(id Bytes, set bool, α, β *Scalar) (*Bit, *Commitment, *Proof) {
+ b := &Bit{
id: id,
set: set,
α: α,
β: β,
}
+ return b, b.commit(), b.proof()
}
func (b *Bit) IsSet() bool {
@@ -122,10 +123,6 @@ func (s *Bit) proof() *Proof {
return pr
}
-func (s *Bit) Commit() (*Commitment, *Proof) {
- return s.commit(), s.proof()
-}
-
func (c *Commitment) Verify(id Bytes, p *Proof) bool {
var e [2][2]*Point