crypto

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package crypto implements some routines to go back and forth from a protobuf point and scalar to a kyber Point and Scalar interface, as well as standard JSON representations.

Package crypto is a generated protocol buffer package.

It is generated from these files:

crypto/element.proto

It has these top-level messages:

Point
Scalar

Index

Constants

This section is empty.

Variables

View Source
var GroupID_name = map[int32]string{
	0:  "Ed25519",
	21: "BN256_G1",
	22: "BN256_G2",
	23: "BN256_GT",
}
View Source
var GroupID_value = map[string]int32{
	"Ed25519":  0,
	"BN256_G1": 21,
	"BN256_G2": 22,
	"BN256_GT": 23,
}

Functions

func GroupToID added in v0.4.0

func GroupToID(g kyber.Group) (int32, bool)

GroupToID returns the ID of a group

func IDToGroup added in v0.4.0

func IDToGroup(id int32) (kyber.Group, bool)

IDToGroup returns the kyber.Group corresponding to the given ID if provided

func ProtoToKyberPoint

func ProtoToKyberPoint(p *ProtobufPoint) (kyber.Point, error)

ProtoToKyberPoint converts a protobuf point to a kyber point

func ProtoToKyberScalar

func ProtoToKyberScalar(p *ProtobufScalar) (kyber.Scalar, error)

ProtoToKyberScalar converts a protobuf scalar to a kyber scalar

Types

type GroupID

type GroupID int32

GroupID is an enumeration holding all possible groups that can be marshalled / unmarshalled, supported by the kyber library

const (
	GroupID_Ed25519  GroupID = 0
	GroupID_BN256_G1 GroupID = 21
	GroupID_BN256_G2 GroupID = 22
	GroupID_BN256_GT GroupID = 23
)

func (GroupID) EnumDescriptor

func (GroupID) EnumDescriptor() ([]byte, []int)

func (GroupID) String

func (x GroupID) String() string

type Point

type Point struct {
	Gid   GroupID `protobuf:"varint,1,opt,name=gid,enum=element.GroupID" json:"gid,omitempty"`
	Point []byte  `protobuf:"bytes,2,opt,name=point,proto3" json:"point,omitempty"`
}

Point represents a point on a curve,i.e. a public key, a commitment etc It is parametrized by its group.

func (*Point) Descriptor

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

func (*Point) GetGid

func (m *Point) GetGid() GroupID

func (*Point) GetPoint added in v0.4.0

func (m *Point) GetPoint() []byte

func (*Point) ProtoMessage

func (*Point) ProtoMessage()

func (*Point) Reset

func (m *Point) Reset()

func (*Point) String

func (m *Point) String() string

type ProtobufPoint

type ProtobufPoint = Point

ProtobufPoint is an alias to a Point represented in a protobuf packet

func KyberToProtoPoint

func KyberToProtoPoint(p kyber.Point) (*ProtobufPoint, error)

KyberToProtoPoint converts a kyber point to a protobuf scalar

func (*ProtobufPoint) FromKyber added in v0.4.0

func (p *ProtobufPoint) FromKyber(point kyber.Point) error

FromKyber unmarshals the protobuf point from the kyber representation

func (*ProtobufPoint) ToKyber added in v0.4.0

func (p *ProtobufPoint) ToKyber() (kyber.Point, error)

ToKyber returns the kyber represnetation of this protobuf point

type ProtobufScalar

type ProtobufScalar = Scalar

ProtobufScalar is an alias to a Scalar represented in a protobuf packet

func KyberToProtoScalar

func KyberToProtoScalar(s kyber.Scalar) (*ProtobufScalar, error)

KyberToProtoScalar converts a kyber scalar to a protobuf scalar

func (*ProtobufScalar) FromKyber added in v0.4.0

func (p *ProtobufScalar) FromKyber(s kyber.Scalar) error

FromKyber unmarshals the protobuf scalar from the kyber representation

func (*ProtobufScalar) ToKyber added in v0.4.0

func (p *ProtobufScalar) ToKyber() (kyber.Scalar, error)

ToKyber returns the kyber represnetation of this protobuf scalar

type Scalar

type Scalar struct {
	Gid    GroupID `protobuf:"varint,1,opt,name=gid,enum=element.GroupID" json:"gid,omitempty"`
	Scalar []byte  `protobuf:"bytes,2,opt,name=scalar,proto3" json:"scalar,omitempty"`
}

Scalar represents a scalar on the field attached to the group. It is parametrized by the group using this field (1-1 mapping).

func (*Scalar) Descriptor

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

func (*Scalar) GetGid

func (m *Scalar) GetGid() GroupID

func (*Scalar) GetScalar added in v0.4.0

func (m *Scalar) GetScalar() []byte

func (*Scalar) ProtoMessage

func (*Scalar) ProtoMessage()

func (*Scalar) Reset

func (m *Scalar) Reset()

func (*Scalar) String

func (m *Scalar) String() string

Directories

Path Synopsis
Package share is a generated protocol buffer package.
Package share is a generated protocol buffer package.
vss
Package vss is a generated protocol buffer package.
Package vss is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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