aboutsummaryrefslogtreecommitdiff
path: root/commitment/commitment.go
blob: 31de03a0ea9f9d5541480f3842fab6525e4743cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Implements the data structures and methods for
// creating a commitment for the SEAL protocol
package commitment

import (
	"kesim.org/seal/curve"
)

type Scalar = curve.Curve25519Scalar
type Point = curve.Curve25519Point

var Curve = curve.Curve25519

type Bidder struct {
	private struct {
		id *Scalar
	}
	Id *Point
}

type Bid struct {
	Bidder *Point
	zbid   uint64 // bigendian encoding of the bid
	bits   []Bit  // derived from zbid
}

type Bit struct {
	id *Scalar
	v  bool
	x  *Scalar
	r  *Scalar
	e  *BitCommitment
}

type BitCommitment struct {
	Id  *Point
	XRV *Point
	X   *Point
	R   *Point

	Proofs struct {
		X *Proof
		R *Proof
	}
}

type Proof struct {
	PV *Point  `json:"V"`
	Sr *Scalar `json:"r"`
}