Documentation
¶
Overview ¶
Package hash_comm provides a simple, non-homomorphic commitment scheme built from a keyed BLAKE2b-256 hash (HMAC-style).
See README.md for details.
Index ¶
Constants ¶
const ( KeySize = 32 DigestSize = 32 // Name identifies the hash-based commitment scheme. Name commitments.Name = "KMACBasedCommitmentScheme" )
Variables ¶
var ( ErrInvalidArgument = errs.New("invalid argument") ErrFailed = errs.New("failed") )
var ( // HmacFunc defines the hash function used to instantiate the HMAC-based commitments. HmacFunc = blake2b.New256 )
Functions ¶
This section is empty.
Types ¶
type Commitment ¶
type Commitment [DigestSize]byte
Commitment is the hash digest produced by the commitment algorithm.
func (Commitment) Bytes ¶
func (c Commitment) Bytes() []byte
Bytes returns the raw commitment digest bytes.
func (Commitment) Equal ¶
func (c Commitment) Equal(other Commitment) bool
type Committer ¶
type Committer struct {
// contains filtered or unexported fields
}
Committer computes hash-based commitments with an HMAC keyed by the CRS output.
func (*Committer) Commit ¶
func (c *Committer) Commit(message Message, prng io.Reader) (commitment Commitment, witness Witness, err error)
Commit samples fresh witness randomness and computes a commitment to the message.
func (*Committer) CommitWithWitness ¶
func (c *Committer) CommitWithWitness(message Message, witness Witness) (commitment Commitment, err error)
CommitWithWitness commits to the message using caller-supplied witness randomness.
type CommitterOption ¶
CommitterOption is a functional option for configuring committers.
type Scheme ¶
type Scheme struct {
// contains filtered or unexported fields
}
Scheme bundles the hash-based committer and verifier using a shared key.
func (*Scheme) Committer ¶
func (s *Scheme) Committer(opts ...CommitterOption) (*Committer, error)
Committer returns a committer initialised with the scheme key.
func (*Scheme) Name ¶
func (*Scheme) Name() commitments.Name
Name returns the identifier of the hash-based commitment scheme.
type Verifier ¶
type Verifier struct {
commitments.GenericVerifier[*Committer, Witness, Message, Commitment]
}
Verifier checks commitments against provided messages and witnesses.
type VerifierOption ¶
VerifierOption is a functional option for configuring verifiers.