Documentation
¶
Index ¶
Constants ¶
const ( // PartsCap is the maximum number of parts allowed in a commitment. PartsCap = 3 // MaxPartSize is the maximum byte size of a single commitment part (1 MB). MaxPartSize = int64(1 * 1024 * 1024) // 1 MB - rather liberal )
const (
// HashLength is the bit length used for generating commitment randomness.
HashLength = 256
)
Variables ¶
This section is empty.
Functions ¶
func NewBuilder ¶
func NewBuilder() *builder
NewBuilder creates a new commitment builder for assembling multi-part secrets.
Types ¶
type HashCommitDecommit ¶
type HashCommitDecommit struct {
C HashCommitment
D HashDeCommitment
}
HashCommitDecommit holds a paired commitment and decommitment for hash-based commitment schemes.
func NewHashCommitment ¶
func NewHashCommitment(rand io.Reader, secrets ...*big.Int) *HashCommitDecommit
NewHashCommitment creates a new hash commitment with a random nonce for the given secrets.
func NewHashCommitmentWithRandomness ¶
func NewHashCommitmentWithRandomness(r *big.Int, secrets ...*big.Int) *HashCommitDecommit
NewHashCommitmentWithRandomness creates a new hash commitment using the provided randomness value r and secrets.
func (*HashCommitDecommit) DeCommit ¶
func (cmt *HashCommitDecommit) DeCommit() (bool, HashDeCommitment)
DeCommit verifies the commitment and, if valid, returns the secret values (excluding the randomness).
func (*HashCommitDecommit) Verify ¶
func (cmt *HashCommitDecommit) Verify() bool
Verify checks that the decommitment D hashes to the commitment C.
type HashCommitment ¶
HashCommitment is a hash-based commitment value.
type HashDeCommitment ¶
HashDeCommitment holds the decommitment values including the randomness and secrets.
func NewHashDeCommitmentFromBytes ¶
func NewHashDeCommitmentFromBytes(marshalled [][]byte) HashDeCommitment
NewHashDeCommitmentFromBytes reconstructs a HashDeCommitment from a slice of byte slices.