commitment

package
v1.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrDifferentLength is returned if the two slices has different lengths.
	ErrDifferentLength = errors.New("different lengths of slices")
	// ErrFailedVerify is returned if it's failed to verify
	ErrFailedVerify = errors.New("failed to verify")
)
View Source
var (
	// ErrDifferentDigest is returned if the two digests are different.
	ErrDifferentDigest = errors.New("different digests")
)

Note: So far, the family of SHA3(i.e. including black2) can protect against length extension attacks.

View Source
var File_github_com_getamis_alice_crypto_commitment_message_proto protoreflect.FileDescriptor

Functions

func ComputePolyEvaluatePoint added in v1.0.2

func ComputePolyEvaluatePoint(fieldOrder *big.Int, bk *bkhoff.BkParameter, pts []*ecpointgrouplaw.ECPoint, degree uint32) (*ecpointgrouplaw.ECPoint, error)

func FeldmanVerify added in v1.0.2

func FeldmanVerify(curve elliptic.Curve, bk *bkhoff.BkParameter, pts []*ecpointgrouplaw.ECPoint, degree uint32, evaluation *big.Int) error

FeldmanVerify verifies the commitment.

func GetPointFromHashCommitment added in v1.0.2

func GetPointFromHashCommitment(commit *HashCommitmentMessage, decommit *HashDecommitmentMessage) (*pt.ECPoint, error)

func GetPointInfoHashCommitment added in v1.0.2

func GetPointInfoHashCommitment(sid []byte, commit *HashCommitmentMessage, decommit *HashDecommitmentMessage) ([]byte, *pt.ECPoint, *pt.ECPoint, error)

Types

type FeldmanCommitmenter

type FeldmanCommitmenter struct {
	// contains filtered or unexported fields
}

func NewFeldmanCommitmenter

func NewFeldmanCommitmenter(curve elliptic.Curve, secrets *polynomial.Polynomial) (*FeldmanCommitmenter, error)

NewFeldmanCommitmenter creates a new FeldmanCommitmenter.

func (*FeldmanCommitmenter) GetCommitmentMessage

func (fc *FeldmanCommitmenter) GetCommitmentMessage() *PointCommitmentMessage

GetCommitmentMessage returns the commitment message.

func (*FeldmanCommitmenter) GetVerifyMessage

func (fc *FeldmanCommitmenter) GetVerifyMessage(bk *bkhoff.BkParameter) *FeldmanVerifyMessage

GetVerifyMessage returns the message for verification. In Feldman commitment, the verification message only contains the secret.

type FeldmanVerifyMessage

type FeldmanVerifyMessage struct {
	Evaluation []byte `protobuf:"bytes,1,opt,name=evaluation,proto3" json:"evaluation,omitempty"`
	// contains filtered or unexported fields
}

FeldmanVerifyMessage contains evaluation for verification use

func (*FeldmanVerifyMessage) Descriptor deprecated

func (*FeldmanVerifyMessage) Descriptor() ([]byte, []int)

Deprecated: Use FeldmanVerifyMessage.ProtoReflect.Descriptor instead.

func (*FeldmanVerifyMessage) GetEvaluation

func (x *FeldmanVerifyMessage) GetEvaluation() []byte

func (*FeldmanVerifyMessage) ProtoMessage

func (*FeldmanVerifyMessage) ProtoMessage()

func (*FeldmanVerifyMessage) ProtoReflect added in v1.0.2

func (x *FeldmanVerifyMessage) ProtoReflect() protoreflect.Message

func (*FeldmanVerifyMessage) Reset

func (x *FeldmanVerifyMessage) Reset()

func (*FeldmanVerifyMessage) String

func (x *FeldmanVerifyMessage) String() string

func (*FeldmanVerifyMessage) Verify

func (vMsg *FeldmanVerifyMessage) Verify(cMsg *PointCommitmentMessage, bk *bkhoff.BkParameter, degree uint32) error

Verify verifies the commitment.

func (*FeldmanVerifyMessage) VerifyByPoints added in v1.0.2

func (vMsg *FeldmanVerifyMessage) VerifyByPoints(curve elliptic.Curve, pts []*pt.ECPoint, bk *bkhoff.BkParameter, degree uint32) error

type HashCommitmentMessage

type HashCommitmentMessage struct {
	Digest []byte `protobuf:"bytes,1,opt,name=digest,proto3" json:"digest,omitempty"`
	// contains filtered or unexported fields
}

HashCommitmentMessage and HashDecommitmentMessage are for HashCommitment HashCommitmentMessage contains the blake2b initial vector and data digest for commitment use

func (*HashCommitmentMessage) Decommit

func (*HashCommitmentMessage) DecommitToProto

func (c *HashCommitmentMessage) DecommitToProto(msg *HashDecommitmentMessage, proroMsg proto.Message) error

func (*HashCommitmentMessage) Descriptor deprecated

func (*HashCommitmentMessage) Descriptor() ([]byte, []int)

Deprecated: Use HashCommitmentMessage.ProtoReflect.Descriptor instead.

func (*HashCommitmentMessage) GetDigest

func (x *HashCommitmentMessage) GetDigest() []byte

func (*HashCommitmentMessage) ProtoMessage

func (*HashCommitmentMessage) ProtoMessage()

func (*HashCommitmentMessage) ProtoReflect added in v1.0.2

func (x *HashCommitmentMessage) ProtoReflect() protoreflect.Message

func (*HashCommitmentMessage) Reset

func (x *HashCommitmentMessage) Reset()

func (*HashCommitmentMessage) String

func (x *HashCommitmentMessage) String() string

type HashCommitmenter

type HashCommitmenter struct {
	// contains filtered or unexported fields
}

func NewCommiterByPointAndSSIDInfo added in v1.0.2

func NewCommiterByPointAndSSIDInfo(sid, id, ridi []byte, A, u0G *pt.ECPoint) (*HashCommitmenter, error)

func NewCommitterByPoint added in v1.0.2

func NewCommitterByPoint(p *pt.ECPoint) (*HashCommitmenter, error)

func NewHashCommitmenter

func NewHashCommitmenter(data []byte) (*HashCommitmenter, error)

func NewProtoHashCommitmenter

func NewProtoHashCommitmenter(msg proto.Message) (*HashCommitmenter, error)

func (*HashCommitmenter) GetCommitmentMessage

func (c *HashCommitmenter) GetCommitmentMessage() *HashCommitmentMessage

func (*HashCommitmenter) GetDecommitmentMessage

func (c *HashCommitmenter) GetDecommitmentMessage() *HashDecommitmentMessage

type HashDecommitmentMessage

type HashDecommitmentMessage struct {
	Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
	Salt []byte `protobuf:"bytes,2,opt,name=salt,proto3" json:"salt,omitempty"`
	// contains filtered or unexported fields
}

HashDecommitmentMessage contains original data and salt for decommitment use

func (*HashDecommitmentMessage) Descriptor deprecated

func (*HashDecommitmentMessage) Descriptor() ([]byte, []int)

Deprecated: Use HashDecommitmentMessage.ProtoReflect.Descriptor instead.

func (*HashDecommitmentMessage) GetData

func (x *HashDecommitmentMessage) GetData() []byte

func (*HashDecommitmentMessage) GetSalt

func (x *HashDecommitmentMessage) GetSalt() []byte

func (*HashDecommitmentMessage) ProtoMessage

func (*HashDecommitmentMessage) ProtoMessage()

func (*HashDecommitmentMessage) ProtoReflect added in v1.0.2

func (x *HashDecommitmentMessage) ProtoReflect() protoreflect.Message

func (*HashDecommitmentMessage) Reset

func (x *HashDecommitmentMessage) Reset()

func (*HashDecommitmentMessage) String

func (x *HashDecommitmentMessage) String() string

type PedersenCommitmenter

type PedersenCommitmenter struct {
	// contains filtered or unexported fields
}

func NewPedersenCommitmenter

func NewPedersenCommitmenter(threshold uint32, hiddingPoint *pt.ECPoint, secrets *polynomial.Polynomial, salts *polynomial.Polynomial) (*PedersenCommitmenter, error)

NewPedersenCommitmenter creates a new PedersenCommitmenter.

func (*PedersenCommitmenter) GetCommitmentMessage

func (pc *PedersenCommitmenter) GetCommitmentMessage() *PointCommitmentMessage

GetCommitmentMessage returns the commitment message.

func (*PedersenCommitmenter) GetVerifyMessage

func (pc *PedersenCommitmenter) GetVerifyMessage(bk *bkhoff.BkParameter) *PedersenVerifyMessage

GetVerifyMessage returns the message for verification. In Pedersen commitment, the verification message contains the secret and salt.

type PedersenVerifyMessage

type PedersenVerifyMessage struct {
	Evaluation []byte `protobuf:"bytes,1,opt,name=evaluation,proto3" json:"evaluation,omitempty"`
	Salt       []byte `protobuf:"bytes,2,opt,name=salt,proto3" json:"salt,omitempty"`
	// contains filtered or unexported fields
}

PedersenVerifyMessage contains evaluation and salt for verification use

func (*PedersenVerifyMessage) Descriptor deprecated

func (*PedersenVerifyMessage) Descriptor() ([]byte, []int)

Deprecated: Use PedersenVerifyMessage.ProtoReflect.Descriptor instead.

func (*PedersenVerifyMessage) GetEvaluation

func (x *PedersenVerifyMessage) GetEvaluation() []byte

func (*PedersenVerifyMessage) GetSalt

func (x *PedersenVerifyMessage) GetSalt() []byte

func (*PedersenVerifyMessage) ProtoMessage

func (*PedersenVerifyMessage) ProtoMessage()

func (*PedersenVerifyMessage) ProtoReflect added in v1.0.2

func (x *PedersenVerifyMessage) ProtoReflect() protoreflect.Message

func (*PedersenVerifyMessage) Reset

func (x *PedersenVerifyMessage) Reset()

func (*PedersenVerifyMessage) String

func (x *PedersenVerifyMessage) String() string

func (*PedersenVerifyMessage) Verify

func (vMsg *PedersenVerifyMessage) Verify(cMsg *PointCommitmentMessage, hiddingPoint *pt.ECPoint, bk *bkhoff.BkParameter, degree uint32) error

Verify verifies the commitment. In DKG, other people denoted by Pj will send the corresponding share f^(ri)(xi), g^(ri)(xi) to the participant Pi who has the x-Coord xi, the rank ri, secret polynomial f(x) and salt polynomial g(x). Then participant Pi can use Pj's pointCommitment to verify the correctness. Let the secret polynomial f(x) = a0+a1*x+...+an*x^n and the salt polynomial g(x) = b0+b1*x+...+bn*x^n and Ci := ai*G + bi*H. f^(ri)(xi)*g^(ri)(xi) = sum_i (x^i)^(ri)*Ci, where (x^i)^(ri) is the monomial polynomial of degree i and differentiate x^i ri times.

type PointCommitmentMessage

type PointCommitmentMessage struct {
	Points []*ecpointgrouplaw.EcPointMessage `protobuf:"bytes,1,rep,name=points,proto3" json:"points,omitempty"`
	// contains filtered or unexported fields
}

PointCommitmentMessage and PointDecommitmentMessage are for PointDecommitment PointCommitmentMessage contains rank and its points for commitment use

func (*PointCommitmentMessage) Descriptor deprecated

func (*PointCommitmentMessage) Descriptor() ([]byte, []int)

Deprecated: Use PointCommitmentMessage.ProtoReflect.Descriptor instead.

func (*PointCommitmentMessage) EcPoints

func (p *PointCommitmentMessage) EcPoints() ([]*pt.ECPoint, error)

func (*PointCommitmentMessage) GetPoints

func (*PointCommitmentMessage) ProtoMessage

func (*PointCommitmentMessage) ProtoMessage()

func (*PointCommitmentMessage) ProtoReflect added in v1.0.2

func (x *PointCommitmentMessage) ProtoReflect() protoreflect.Message

func (*PointCommitmentMessage) Reset

func (x *PointCommitmentMessage) Reset()

func (*PointCommitmentMessage) String

func (x *PointCommitmentMessage) String() string

type PointSSIDInfoMessage added in v1.0.2

type PointSSIDInfoMessage struct {
	U0G *ecpointgrouplaw.EcPointMessage `protobuf:"bytes,1,opt,name=u0G,proto3" json:"u0G,omitempty"`
	Sid []byte                          `protobuf:"bytes,2,opt,name=sid,proto3" json:"sid,omitempty"`
	Rid []byte                          `protobuf:"bytes,3,opt,name=rid,proto3" json:"rid,omitempty"`
	ID  []byte                          `protobuf:"bytes,4,opt,name=ID,proto3" json:"ID,omitempty"`
	A   *ecpointgrouplaw.EcPointMessage `protobuf:"bytes,5,opt,name=A,proto3" json:"A,omitempty"`
	// contains filtered or unexported fields
}

func (*PointSSIDInfoMessage) Descriptor deprecated added in v1.0.2

func (*PointSSIDInfoMessage) Descriptor() ([]byte, []int)

Deprecated: Use PointSSIDInfoMessage.ProtoReflect.Descriptor instead.

func (*PointSSIDInfoMessage) GetA added in v1.0.2

func (*PointSSIDInfoMessage) GetID added in v1.0.2

func (x *PointSSIDInfoMessage) GetID() []byte

func (*PointSSIDInfoMessage) GetRid added in v1.0.2

func (x *PointSSIDInfoMessage) GetRid() []byte

func (*PointSSIDInfoMessage) GetSid added in v1.0.2

func (x *PointSSIDInfoMessage) GetSid() []byte

func (*PointSSIDInfoMessage) GetU0G added in v1.0.2

func (*PointSSIDInfoMessage) ProtoMessage added in v1.0.2

func (*PointSSIDInfoMessage) ProtoMessage()

func (*PointSSIDInfoMessage) ProtoReflect added in v1.0.2

func (x *PointSSIDInfoMessage) ProtoReflect() protoreflect.Message

func (*PointSSIDInfoMessage) Reset added in v1.0.2

func (x *PointSSIDInfoMessage) Reset()

func (*PointSSIDInfoMessage) String added in v1.0.2

func (x *PointSSIDInfoMessage) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL