bls

package module
v0.2.2-0...-06b63c5 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2021 License: MIT Imports: 12 Imported by: 0

README

CircleCI

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

View Source
var Domain = []byte("BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_")

Domain comes from the ciphersuite used by the RFC of this name compatible with the paired library > v18

Functions

func NewBLS12381Suite

func NewBLS12381Suite() pairing.Suite

func NewGroupG1

func NewGroupG1() kyber.Group

func NewGroupG2

func NewGroupG2() kyber.Group

func NewGroupGT

func NewGroupGT() kyber.Group

func NewKyberScalar

func NewKyberScalar() kyber.Scalar

Types

type Fr32

type Fr32 struct {
	V *bls12381.Fr // Integer value from 0 through N-1
}

func NewFr32

func NewFr32() *Fr32

NewInt creaters a new Int with a given big.Int and a big.Int modulus.

func (*Fr32) Add

func (s *Fr32) Add(a, b kyber.Scalar) kyber.Scalar

Set to the modular sum of kyber.Scalars a and b.

func (*Fr32) Clone

func (s *Fr32) Clone() kyber.Scalar

Clone creates a new kyber.Scalar with the same value.

func (*Fr32) Div

func (s *Fr32) Div(a, b kyber.Scalar) kyber.Scalar

Set to the modular division of kyber.Scalar a by kyber.Scalar b.

func (*Fr32) Equal

func (s *Fr32) Equal(s2 kyber.Scalar) bool

Equality test for two kyber.Scalars derived from the same Group.

func (*Fr32) Inv

func (s *Fr32) Inv(a kyber.Scalar) kyber.Scalar

Set to the modular inverse of kyber.Scalar a.

func (*Fr32) MarshalBinary

func (s *Fr32) MarshalBinary() (data []byte, err error)

func (*Fr32) MarshalSize

func (s *Fr32) MarshalSize() int

Encoded length of this object in bytes.

func (*Fr32) MarshalTo

func (s *Fr32) MarshalTo(w io.Writer) (int, error)

Encode the contents of this object and write it to an io.Writer.

func (*Fr32) Mul

func (s *Fr32) Mul(a, b kyber.Scalar) kyber.Scalar

Set to the modular product of kyber.Scalars a and b.

func (*Fr32) Neg

func (s *Fr32) Neg(a kyber.Scalar) kyber.Scalar

Set to the modular negation of kyber.Scalar a.

func (*Fr32) One

func (s *Fr32) One() kyber.Scalar

Set to the multiplicative identity (1).

func (*Fr32) Pick

func (s *Fr32) Pick(rand cipher.Stream) kyber.Scalar

Set to a fresh random or pseudo-random kyber.Scalar.

func (*Fr32) Set

func (s *Fr32) Set(a kyber.Scalar) kyber.Scalar

Set sets the receiver equal to another kyber.Scalar a.

func (*Fr32) SetBytes

func (s *Fr32) SetBytes(b []byte) kyber.Scalar

SetBytes sets the kyber.Scalar from a byte-slice, reducing if necessary to the appropriate modulus. The endianess of the byte-slice is determined by the implementation.

func (*Fr32) SetInt64

func (s *Fr32) SetInt64(v int64) kyber.Scalar

SetInt64 sets the receiver to a small integer value.

func (*Fr32) String

func (s *Fr32) String() string

String returns the human readable string representation of the object.

func (*Fr32) Sub

func (s *Fr32) Sub(a, b kyber.Scalar) kyber.Scalar

Set to the modular difference a - b.

func (*Fr32) UnmarshalBinary

func (s *Fr32) UnmarshalBinary(data []byte) error

func (*Fr32) UnmarshalFrom

func (s *Fr32) UnmarshalFrom(r io.Reader) (int, error)

Decode the content of this object by reading from an io.Reader. If r is an XOF, it uses r to pick a valid object pseudo-randomly, which may entail reading more than Len bytes due to retries.

func (*Fr32) Zero

func (s *Fr32) Zero() kyber.Scalar

Set to the additive identity (0).

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 {
	// contains filtered or unexported fields
}

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

func NullKyberG1

func NullKyberG1() *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)

func (*KyberG1) MarshalSize

func (k *KyberG1) MarshalSize() int

func (*KyberG1) MarshalTo

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

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

func (*KyberG1) UnmarshalFrom

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

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() *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)

func (*KyberG2) MarshalSize

func (k *KyberG2) MarshalSize() int

func (*KyberG2) MarshalTo

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

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

func (*KyberG2) UnmarshalFrom

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

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{}

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) 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 newlly instantiated blake2xb XOF function.

Directories

Path Synopsis
tests
consumer command
generator command

Jump to

Keyboard shortcuts

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