commitment

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2020 License: Apache-2.0 Imports: 12 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.

Functions

This section is empty.

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"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

FeldmanVerifyMessage contains evaluation for verification use

func (*FeldmanVerifyMessage) Descriptor

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

func (*FeldmanVerifyMessage) GetEvaluation

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

func (*FeldmanVerifyMessage) ProtoMessage

func (*FeldmanVerifyMessage) ProtoMessage()

func (*FeldmanVerifyMessage) Reset

func (m *FeldmanVerifyMessage) Reset()

func (*FeldmanVerifyMessage) String

func (m *FeldmanVerifyMessage) String() string

func (*FeldmanVerifyMessage) Verify

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

Verify verifies the commitment.

func (*FeldmanVerifyMessage) XXX_DiscardUnknown

func (m *FeldmanVerifyMessage) XXX_DiscardUnknown()

func (*FeldmanVerifyMessage) XXX_Marshal

func (m *FeldmanVerifyMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*FeldmanVerifyMessage) XXX_Merge

func (m *FeldmanVerifyMessage) XXX_Merge(src proto.Message)

func (*FeldmanVerifyMessage) XXX_Size

func (m *FeldmanVerifyMessage) XXX_Size() int

func (*FeldmanVerifyMessage) XXX_Unmarshal

func (m *FeldmanVerifyMessage) XXX_Unmarshal(b []byte) error

type HashCommitmentMessage

type HashCommitmentMessage struct {
	Blake2BKey           []byte   `protobuf:"bytes,1,opt,name=blake2bKey,proto3" json:"blake2bKey,omitempty"`
	Digest               []byte   `protobuf:"bytes,2,opt,name=digest,proto3" json:"digest,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

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

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

func (*HashCommitmentMessage) GetBlake2BKey

func (m *HashCommitmentMessage) GetBlake2BKey() []byte

func (*HashCommitmentMessage) GetDigest

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

func (*HashCommitmentMessage) ProtoMessage

func (*HashCommitmentMessage) ProtoMessage()

func (*HashCommitmentMessage) Reset

func (m *HashCommitmentMessage) Reset()

func (*HashCommitmentMessage) String

func (m *HashCommitmentMessage) String() string

func (*HashCommitmentMessage) XXX_DiscardUnknown

func (m *HashCommitmentMessage) XXX_DiscardUnknown()

func (*HashCommitmentMessage) XXX_Marshal

func (m *HashCommitmentMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*HashCommitmentMessage) XXX_Merge

func (m *HashCommitmentMessage) XXX_Merge(src proto.Message)

func (*HashCommitmentMessage) XXX_Size

func (m *HashCommitmentMessage) XXX_Size() int

func (*HashCommitmentMessage) XXX_Unmarshal

func (m *HashCommitmentMessage) XXX_Unmarshal(b []byte) error

type HashCommitmenter

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

func NewHashCommitmenter

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

func NewProtoHashCommitmenter

func NewProtoHashCommitmenter(msg proto.Message, minSaltSize int) (*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"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

HashDecommitmentMessage contains original data and salt for decommitment use

func (*HashDecommitmentMessage) Descriptor

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

func (*HashDecommitmentMessage) GetData

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

func (*HashDecommitmentMessage) GetSalt

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

func (*HashDecommitmentMessage) ProtoMessage

func (*HashDecommitmentMessage) ProtoMessage()

func (*HashDecommitmentMessage) Reset

func (m *HashDecommitmentMessage) Reset()

func (*HashDecommitmentMessage) String

func (m *HashDecommitmentMessage) String() string

func (*HashDecommitmentMessage) XXX_DiscardUnknown

func (m *HashDecommitmentMessage) XXX_DiscardUnknown()

func (*HashDecommitmentMessage) XXX_Marshal

func (m *HashDecommitmentMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*HashDecommitmentMessage) XXX_Merge

func (m *HashDecommitmentMessage) XXX_Merge(src proto.Message)

func (*HashDecommitmentMessage) XXX_Size

func (m *HashDecommitmentMessage) XXX_Size() int

func (*HashDecommitmentMessage) XXX_Unmarshal

func (m *HashDecommitmentMessage) XXX_Unmarshal(b []byte) error

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"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

PedersenVerifyMessage contains evaluation and salt for verification use

func (*PedersenVerifyMessage) Descriptor

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

func (*PedersenVerifyMessage) GetEvaluation

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

func (*PedersenVerifyMessage) GetSalt

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

func (*PedersenVerifyMessage) ProtoMessage

func (*PedersenVerifyMessage) ProtoMessage()

func (*PedersenVerifyMessage) Reset

func (m *PedersenVerifyMessage) Reset()

func (*PedersenVerifyMessage) String

func (m *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.

func (*PedersenVerifyMessage) XXX_DiscardUnknown

func (m *PedersenVerifyMessage) XXX_DiscardUnknown()

func (*PedersenVerifyMessage) XXX_Marshal

func (m *PedersenVerifyMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PedersenVerifyMessage) XXX_Merge

func (m *PedersenVerifyMessage) XXX_Merge(src proto.Message)

func (*PedersenVerifyMessage) XXX_Size

func (m *PedersenVerifyMessage) XXX_Size() int

func (*PedersenVerifyMessage) XXX_Unmarshal

func (m *PedersenVerifyMessage) XXX_Unmarshal(b []byte) error

type PointCommitmentMessage

type PointCommitmentMessage struct {
	Points               []*ecpointgrouplaw.EcPointMessage `protobuf:"bytes,1,rep,name=points,proto3" json:"points,omitempty"`
	XXX_NoUnkeyedLiteral struct{}                          `json:"-"`
	XXX_unrecognized     []byte                            `json:"-"`
	XXX_sizecache        int32                             `json:"-"`
}

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

func (*PointCommitmentMessage) Descriptor

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

func (*PointCommitmentMessage) EcPoints

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

func (*PointCommitmentMessage) GetPoints

func (*PointCommitmentMessage) ProtoMessage

func (*PointCommitmentMessage) ProtoMessage()

func (*PointCommitmentMessage) Reset

func (m *PointCommitmentMessage) Reset()

func (*PointCommitmentMessage) String

func (m *PointCommitmentMessage) String() string

func (*PointCommitmentMessage) XXX_DiscardUnknown

func (m *PointCommitmentMessage) XXX_DiscardUnknown()

func (*PointCommitmentMessage) XXX_Marshal

func (m *PointCommitmentMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PointCommitmentMessage) XXX_Merge

func (m *PointCommitmentMessage) XXX_Merge(src proto.Message)

func (*PointCommitmentMessage) XXX_Size

func (m *PointCommitmentMessage) XXX_Size() int

func (*PointCommitmentMessage) XXX_Unmarshal

func (m *PointCommitmentMessage) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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