diff options
| author | Özgür Kesim <oec@codeblau.de> | 2024-04-07 18:38:33 +0200 |
|---|---|---|
| committer | Özgür Kesim <oec@codeblau.de> | 2024-04-07 18:38:33 +0200 |
| commit | 03d3f676c36ccd36bb201d317bd2350ada6ba451 (patch) | |
| tree | 92e2d7e80b62c770b46b4f8e245c6f15083d120a /bidder/bid.go | |
| parent | efdafce2cca00591371338d20ee456770216a829 (diff) | |
nizk, bidder: introduced schnorr-signatures as proof for commitments of A=G^a and B=G^b
Diffstat (limited to 'bidder/bid.go')
| -rw-r--r-- | bidder/bid.go | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/bidder/bid.go b/bidder/bid.go index 55feaf8..5a87aa1 100644 --- a/bidder/bid.go +++ b/bidder/bid.go @@ -1,7 +1,6 @@ package bidder import ( - "crypto/ed25519" "fmt" . "kesim.org/seal/nizk" @@ -10,8 +9,9 @@ import ( ) type bid struct { - id ed25519.PrivateKey - ID ed25519.PublicKey + // TODO: These should probably become ed25519.(Private|Public)Key's + id *Scalar + Id *Point price uint64 // bigendian encoding of the bid n uint8 // number of bits encoded in zbid. @@ -29,18 +29,14 @@ func NewBid(price uint64, bitlength uint8) (*bid, error) { return nil, fmt.Errorf("price %d too large for given bitlength %d", price, bitlength) } - var ( - e error - bid = &bid{ - price: price, - } - ) - - bid.ID, bid.id, e = ed25519.GenerateKey(nil) - if e != nil { - return nil, e + bid := &bid{ + price: price, + n: bitlength, } + bid.id = Curve.RandomScalar() + bid.Id = G.Exp(bid.id) + bid.bits = make([]*commit.Statement, bitlength) for i := bitlength; i > 0; i-- { set := (price>>(i-1)&1 != 0) @@ -53,12 +49,12 @@ func NewBid(price uint64, bitlength uint8) (*bid, error) { // Commit returns the public commitment to the bits and a signature // TODO: return signature over bid -func (bid *bid) Commit() (c []*commit.Commitment, pub ed25519.PublicKey, sig []byte) { +func (bid *bid) Commit() (c []*commit.Commitment) { c = make([]*commit.Commitment, len(bid.bits)) for i := range bid.bits { - c[i] = bid.bits[i].Commit() + c[i] = bid.bits[i].Commit(bid.Id) } - return c, bid.ID, nil + return c } func (bid *bid) Result() { |
