tebn254

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SeedH     = "ZkBNBTwistedEdwardsBn254HSeed"
	SeedU     = "ZkBNBTwistedEdwardsBn254USeed"
	PointSize = 32
)

Variables

View Source
var (
	ErrMapToGroup       = errors.New("Failed to Hash-to-point.")
	ErrInvalidPointSize = errors.New("err: invalid point size")
)
View Source
var (
	Order   = &curve.Order
	G       = &curve.Base
	Modulus = fr.Modulus()
	H       *Point
	U       *Point
	O       = Point{X: *new(fr.Element).SetZero(), Y: *new(fr.Element).SetOne()}
)

Functions

func IsInSubGroup

func IsInSubGroup(p *Point) bool

func IsZero

func IsZero(p *Point) bool

func RandomValue

func RandomValue() *big.Int

func ToBytes

func ToBytes(p *Point) []byte

func ToString

func ToString(p *Point) string

func VecToBytes

func VecToBytes(vp []*Point) ([]byte, error)

Types

type Point

func Add

func Add(a, b *Point) *Point

func FromBytes

func FromBytes(pBytes []byte) (*Point, error)

func FromString

func FromString(pStr string) (*Point, error)

func MapToGroup

func MapToGroup(seed string) (H *Point, err error)

func Neg

func Neg(a *Point) *Point

func ScalarBaseMul

func ScalarBaseMul(a *big.Int) *Point

func ScalarMul

func ScalarMul(p *Point, a *big.Int) *Point

func ZeroPoint

func ZeroPoint() *Point

type PrivateKey

type PrivateKey = eddsa.PrivateKey

func GenerateEddsaPrivateKey

func GenerateEddsaPrivateKey(seed string) (sk *PrivateKey, err error)

GenerateEddsaPrivateKey: generate eddsa private key

func GenerateKey

func GenerateKey(r io.Reader) (*PrivateKey, error)

type PublicKey

type PublicKey = eddsa.PublicKey

Jump to

Keyboard shortcuts

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