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 ¶
- Variables
- func GroupToID(g kyber.Group) (int32, bool)
- func IDToGroup(id int32) (kyber.Group, bool)
- func ProtoToKyberPoint(p *ProtobufPoint) (kyber.Point, error)
- func ProtoToKyberScalar(p *ProtobufScalar) (kyber.Scalar, error)
- type GroupID
- type Point
- type ProtobufPoint
- type ProtobufScalar
- type Scalar
Constants ¶
This section is empty.
Variables ¶
var GroupID_name = map[int32]string{
0: "Ed25519",
21: "BN256_G1",
22: "BN256_G2",
23: "BN256_GT",
}
var GroupID_value = map[string]int32{
"Ed25519": 0,
"BN256_G1": 21,
"BN256_G2": 22,
"BN256_GT": 23,
}
Functions ¶
func IDToGroup ¶ added in v0.4.0
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
func (GroupID) EnumDescriptor ¶
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) ProtoMessage ¶
func (*Point) ProtoMessage()
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
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
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) ProtoMessage ¶
func (*Scalar) ProtoMessage()