bls

package module
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2023 License: MIT Imports: 14 Imported by: 25

README

kyber-bls12381

Kyber wrapper around kilic/bls12381 library.

Note: GT does not fully support the kyber.Point interface yet.

Previous library

This repository is the successor of the previous library bls12381 which was a complete fork of the upstream library.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultDomainG1 added in v0.3.0

func DefaultDomainG1() []byte

func DefaultDomainG2 added in v0.3.0

func DefaultDomainG2() []byte

func NewBLS12381Suite

func NewBLS12381Suite() pairing.Suite

NewBLS12381Suite is the same as calling NewBLS12381SuiteWithDST(nil, nil): it uses the default domain separation tags for its Hash To Curve functions.

func NewBLS12381SuiteWithDST added in v0.3.0

func NewBLS12381SuiteWithDST(DomainG1, DomainG2 []byte) pairing.Suite

NewBLS12381SuiteWithDST allows you to set your own domain separation tags to be used by the Hash To Curve functions. Since the DST shouldn't be 0 len, if you provide nil or a 0 len byte array, it will use the RFC default values.

func NewGroupG1

func NewGroupG1(dst ...byte) kyber.Group

func NewGroupG2

func NewGroupG2(dst ...byte) kyber.Group

func NewGroupGT

func NewGroupGT() kyber.Group

func NewKyberScalar

func NewKyberScalar() kyber.Scalar

Types

type GroupChecker

type GroupChecker interface {
	kyber.Point
	IsInCorrectGroup() bool
}

GroupChecker allows to verify if a Point is in the correct group or not. For curves which don't have a prime order, we need to only consider the points lying in the subgroup of prime order. That check returns true if the point is correct or not.

type KyberG1

type KyberG1 struct {
	kyber.Point
	kyber.HashablePoint
	// contains filtered or unexported fields
}

KyberG1 is a kyber.Point holding a G1 point on BLS12-381 curve

func NullKyberG1

func NullKyberG1(dst ...byte) *KyberG1

func (*KyberG1) Add

func (k *KyberG1) Add(a, b kyber.Point) kyber.Point

func (*KyberG1) Base

func (k *KyberG1) Base() kyber.Point

func (*KyberG1) Clone

func (k *KyberG1) Clone() kyber.Point

func (*KyberG1) Data

func (k *KyberG1) Data() ([]byte, error)

func (*KyberG1) Embed

func (k *KyberG1) Embed(data []byte, rand cipher.Stream) kyber.Point

func (*KyberG1) EmbedLen

func (k *KyberG1) EmbedLen() int

func (*KyberG1) Equal

func (k *KyberG1) Equal(k2 kyber.Point) bool

func (*KyberG1) Hash

func (k *KyberG1) Hash(m []byte) kyber.Point

func (*KyberG1) IsInCorrectGroup

func (k *KyberG1) IsInCorrectGroup() bool

func (*KyberG1) MarshalBinary

func (k *KyberG1) MarshalBinary() ([]byte, error)

MarshalBinary returns a compressed point, without any domain separation tag information

func (*KyberG1) MarshalSize

func (k *KyberG1) MarshalSize() int

func (*KyberG1) MarshalTo

func (k *KyberG1) MarshalTo(w io.Writer) (int, error)

MarshalTo writes a compressed point to the Writer, without any domain separation tag information

func (*KyberG1) Mul

func (k *KyberG1) Mul(s kyber.Scalar, q kyber.Point) kyber.Point

func (*KyberG1) Neg

func (k *KyberG1) Neg(a kyber.Point) kyber.Point

func (*KyberG1) Null

func (k *KyberG1) Null() kyber.Point

func (*KyberG1) Pick

func (k *KyberG1) Pick(rand cipher.Stream) kyber.Point

func (*KyberG1) Set

func (k *KyberG1) Set(q kyber.Point) kyber.Point

func (*KyberG1) String

func (k *KyberG1) String() string

func (*KyberG1) Sub

func (k *KyberG1) Sub(a, b kyber.Point) kyber.Point

func (*KyberG1) UnmarshalBinary

func (k *KyberG1) UnmarshalBinary(buff []byte) error

UnmarshalBinary populates the point from a compressed point representation.

func (*KyberG1) UnmarshalFrom

func (k *KyberG1) UnmarshalFrom(r io.Reader) (int, error)

UnmarshalFrom populates the point from a compressed point representation read from the Reader.

type KyberG2

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

KyberG2 is a kyber.Point holding a G2 point on BLS12-381 curve

func NullKyberG2

func NullKyberG2(dst ...byte) *KyberG2

func (*KyberG2) Add

func (k *KyberG2) Add(a, b kyber.Point) kyber.Point

func (*KyberG2) Base

func (k *KyberG2) Base() kyber.Point

func (*KyberG2) Clone

func (k *KyberG2) Clone() kyber.Point

func (*KyberG2) Data

func (k *KyberG2) Data() ([]byte, error)

func (*KyberG2) Embed

func (k *KyberG2) Embed(data []byte, rand cipher.Stream) kyber.Point

func (*KyberG2) EmbedLen

func (k *KyberG2) EmbedLen() int

func (*KyberG2) Equal

func (k *KyberG2) Equal(k2 kyber.Point) bool

func (*KyberG2) Hash

func (k *KyberG2) Hash(m []byte) kyber.Point

func (*KyberG2) IsInCorrectGroup

func (k *KyberG2) IsInCorrectGroup() bool

func (*KyberG2) MarshalBinary

func (k *KyberG2) MarshalBinary() ([]byte, error)

MarshalBinary returns a compressed point, without any domain separation tag information

func (*KyberG2) MarshalSize

func (k *KyberG2) MarshalSize() int

func (*KyberG2) MarshalTo

func (k *KyberG2) MarshalTo(w io.Writer) (int, error)

MarshalTo writes a compressed point to the Writer, without any domain separation tag information

func (*KyberG2) Mul

func (k *KyberG2) Mul(s kyber.Scalar, q kyber.Point) kyber.Point

func (*KyberG2) Neg

func (k *KyberG2) Neg(a kyber.Point) kyber.Point

func (*KyberG2) Null

func (k *KyberG2) Null() kyber.Point

func (*KyberG2) Pick

func (k *KyberG2) Pick(rand cipher.Stream) kyber.Point

func (*KyberG2) Set

func (k *KyberG2) Set(q kyber.Point) kyber.Point

func (*KyberG2) String

func (k *KyberG2) String() string

func (*KyberG2) Sub

func (k *KyberG2) Sub(a, b kyber.Point) kyber.Point

func (*KyberG2) UnmarshalBinary

func (k *KyberG2) UnmarshalBinary(buff []byte) error

UnmarshalBinary populates the point from a compressed point representation.

func (*KyberG2) UnmarshalFrom

func (k *KyberG2) UnmarshalFrom(r io.Reader) (int, error)

UnmarshalFrom populates the point from a compressed point representation read from the Reader.

type KyberGT

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

func (*KyberGT) Add

func (k *KyberGT) Add(a, b kyber.Point) kyber.Point

func (*KyberGT) Base

func (k *KyberGT) Base() kyber.Point

func (*KyberGT) Clone

func (k *KyberGT) Clone() kyber.Point

func (*KyberGT) Data

func (k *KyberGT) Data() ([]byte, error)

func (*KyberGT) Embed

func (k *KyberGT) Embed(data []byte, rand cipher.Stream) kyber.Point

func (*KyberGT) EmbedLen

func (k *KyberGT) EmbedLen() int

func (*KyberGT) Equal

func (k *KyberGT) Equal(kk kyber.Point) bool

func (*KyberGT) MarshalBinary

func (k *KyberGT) MarshalBinary() ([]byte, error)

func (*KyberGT) MarshalSize

func (k *KyberGT) MarshalSize() int

func (*KyberGT) MarshalTo

func (k *KyberGT) MarshalTo(w io.Writer) (int, error)

func (*KyberGT) Mul

func (k *KyberGT) Mul(s kyber.Scalar, q kyber.Point) kyber.Point

func (*KyberGT) Neg

func (k *KyberGT) Neg(q kyber.Point) kyber.Point

func (*KyberGT) Null

func (k *KyberGT) Null() kyber.Point

func (*KyberGT) Pick

func (k *KyberGT) Pick(rand cipher.Stream) kyber.Point

func (*KyberGT) Set

func (k *KyberGT) Set(q kyber.Point) kyber.Point

func (*KyberGT) String

func (k *KyberGT) String() string

func (*KyberGT) Sub

func (k *KyberGT) Sub(a, b kyber.Point) kyber.Point

func (*KyberGT) UnmarshalBinary

func (k *KyberGT) UnmarshalBinary(buf []byte) error

func (*KyberGT) UnmarshalFrom

func (k *KyberGT) UnmarshalFrom(r io.Reader) (int, error)

type Suite

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

func (*Suite) G1

func (s *Suite) G1() kyber.Group

func (*Suite) G2

func (s *Suite) G2() kyber.Group

func (*Suite) GT

func (s *Suite) GT() kyber.Group

func (*Suite) Hash

func (s *Suite) Hash() hash.Hash

Hash returns a newly instantiated sha256 hash function.

func (*Suite) New

func (s *Suite) New(t reflect.Type) interface{}

New implements the kyber.Encoding interface.

func (*Suite) Pair

func (s *Suite) Pair(p1, p2 kyber.Point) kyber.Point

func (*Suite) RandomStream

func (s *Suite) RandomStream() cipher.Stream

RandomStream returns a cipher.Stream which corresponds to a key stream from crypto/rand.

func (*Suite) Read

func (s *Suite) Read(r io.Reader, objs ...interface{}) error

Read is the default implementation of kyber.Encoding interface Read.

func (*Suite) SetDomainG1 added in v0.3.0

func (s *Suite) SetDomainG1(dst []byte)

func (*Suite) SetDomainG2 added in v0.3.0

func (s *Suite) SetDomainG2(dst []byte)

func (*Suite) ValidatePairing

func (s *Suite) ValidatePairing(p1, p2, p3, p4 kyber.Point) bool

ValidatePairing implements the `pairing.Suite` interface

func (*Suite) Write

func (s *Suite) Write(w io.Writer, objs ...interface{}) error

Write is the default implementation of kyber.Encoding interface Write.

func (*Suite) XOF

func (s *Suite) XOF(seed []byte) kyber.XOF

XOF returns a newly instantiated blake2xb XOF function.

Directories

Path Synopsis
tests

Jump to

Keyboard shortcuts

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