operation

package
v0.0.0-...-6729ccb Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Ed25519KeySize     = 32
	TxRandomIndexSize  = 4
	CStringBulletProof = "bulletproof"
	CStringAssetTag    = "blindedassettag"
	CStringOTA         = "onetimeaddress"
)
View Source
const (
	PedersenPrivateKeyIndex = byte(0x00)
	PedersenValueIndex      = byte(0x01)
	PedersenSndIndex        = byte(0x02)
	PedersenShardIDIndex    = byte(0x03)
	PedersenRandomnessIndex = byte(0x04)
)

Variables

This section is empty.

Functions

func CheckDuplicateScalarArray

func CheckDuplicateScalarArray(arr []*Scalar) bool

func Compare

func Compare(sca, scb *Scalar) int

func IsPointEqual

func IsPointEqual(pa *Point, pb *Point) bool

func IsScalarEqual

func IsScalarEqual(sc1, sc2 *Scalar) bool

func Reverse

func Reverse(x C25519.Key) (result C25519.Key)

Types

type PedersenCommitment

type PedersenCommitment struct {
	G []*Point // generators

}

PedersenCommitment represents the parameters for the commitment

func NewPedersenParams

func NewPedersenParams() PedersenCommitment

func (PedersenCommitment) CommitAll

func (com PedersenCommitment) CommitAll(openings []*Scalar) (*Point, error)

CommitAll commits a list of PCM_CAPACITY value(s)

func (PedersenCommitment) CommitAtIndex

func (com PedersenCommitment) CommitAtIndex(value, rand *Scalar, index byte) *Point

CommitAtIndex commits specific value with index and returns 34 bytes g^v x h^rand

type Point

type Point struct {
	// contains filtered or unexported fields
}
var GBase, HBase, RandomBase *Point

func HashToPoint

func HashToPoint(b []byte) *Point

func HashToPointFromIndex

func HashToPointFromIndex(index int64, padStr string) *Point

func RandomPoint

func RandomPoint() *Point

func (*Point) Add

func (p *Point) Add(pa, pb *Point) *Point

func (*Point) AddPedersen

func (p *Point) AddPedersen(a *Scalar, A *Point, b *Scalar, B *Point) *Point

aA + bB

func (*Point) AddPedersenCached

func (p *Point) AddPedersenCached(a *Scalar, APreCompute [8]C25519.CachedGroupElement, b *Scalar, BPreCompute [8]C25519.CachedGroupElement) *Point

func (*Point) Derive

func (p *Point) Derive(pa *Point, a *Scalar, b *Scalar) *Point

func (*Point) FromBytes

func (p *Point) FromBytes(b [Ed25519KeySize]byte) (*Point, error)

func (*Point) FromBytesS

func (p *Point) FromBytesS(b []byte) (*Point, error)

func (Point) GetKey

func (p Point) GetKey() C25519.Key

func (*Point) Identity

func (p *Point) Identity() *Point

func (*Point) InvertScalarMult

func (p *Point) InvertScalarMult(pa *Point, a *Scalar) *Point

func (*Point) InvertScalarMultBase

func (p *Point) InvertScalarMultBase(a *Scalar) *Point

func (Point) IsIdentity

func (p Point) IsIdentity() bool

func (Point) MarshalText

func (p Point) MarshalText() []byte

func (*Point) MultiScalarMult

func (p *Point) MultiScalarMult(scalarLs []*Scalar, pointLs []*Point) *Point

func (*Point) MultiScalarMultCached

func (p *Point) MultiScalarMultCached(scalarLs []*Scalar, pointPreComputedLs [][8]C25519.CachedGroupElement) *Point

func (Point) PointValid

func (p Point) PointValid() bool

func (*Point) ScalarMult

func (p *Point) ScalarMult(pa *Point, a *Scalar) *Point

func (*Point) ScalarMultBase

func (p *Point) ScalarMultBase(a *Scalar) *Point

does a * G where a is a scalar and G is the curve basepoint

func (*Point) Set

func (p *Point) Set(q *Point) *Point

func (*Point) SetKey

func (p *Point) SetKey(a *C25519.Key) (*Point, error)

func (Point) String

func (p Point) String() string

func (*Point) Sub

func (p *Point) Sub(pa, pb *Point) *Point

func (Point) ToBytes

func (p Point) ToBytes() [Ed25519KeySize]byte

func (Point) ToBytesS

func (p Point) ToBytesS() []byte

func (*Point) UnmarshalText

func (p *Point) UnmarshalText(data []byte) (*Point, error)

type Scalar

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

func HashToScalar

func HashToScalar(data []byte) *Scalar

func RandomScalar

func RandomScalar() *Scalar

func (*Scalar) Add

func (sc *Scalar) Add(a, b *Scalar) *Scalar

func (*Scalar) Exp

func (sc *Scalar) Exp(a *Scalar, v uint64) *Scalar

func (*Scalar) FromBytes

func (sc *Scalar) FromBytes(b [Ed25519KeySize]byte) *Scalar

func (*Scalar) FromBytesS

func (sc *Scalar) FromBytesS(b []byte) *Scalar

func (*Scalar) FromUint64

func (sc *Scalar) FromUint64(i uint64) *Scalar

func (Scalar) GetKey

func (sc Scalar) GetKey() C25519.Key

func (*Scalar) Invert

func (sc *Scalar) Invert(a *Scalar) *Scalar

func (*Scalar) IsOne

func (sc *Scalar) IsOne() bool

func (*Scalar) IsZero

func (sc *Scalar) IsZero() bool

func (Scalar) MarshalText

func (sc Scalar) MarshalText() []byte

func (*Scalar) Mul

func (sc *Scalar) Mul(a, b *Scalar) *Scalar

func (*Scalar) MulAdd

func (sc *Scalar) MulAdd(a, b, c *Scalar) *Scalar

a*b + c % l

func (*Scalar) ScalarValid

func (sc *Scalar) ScalarValid() bool

func (*Scalar) Set

func (sc *Scalar) Set(a *Scalar) *Scalar

func (*Scalar) SetKey

func (sc *Scalar) SetKey(a *C25519.Key) (*Scalar, error)

func (*Scalar) SetKeyUnsafe

func (p *Scalar) SetKeyUnsafe(a *C25519.Key) *Scalar

Should not use this if you don't know what you are doing

func (Scalar) String

func (sc Scalar) String() string

func (*Scalar) Sub

func (sc *Scalar) Sub(a, b *Scalar) *Scalar

func (Scalar) ToBytes

func (sc Scalar) ToBytes() [Ed25519KeySize]byte

func (Scalar) ToBytesS

func (sc Scalar) ToBytesS() []byte

func (*Scalar) ToUint64Little

func (sc *Scalar) ToUint64Little() uint64

func (*Scalar) UnmarshalText

func (sc *Scalar) UnmarshalText(data []byte) (*Scalar, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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