swu

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2019 License: BSD-3-Clause Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	//PointHashLen is the length of a number that represents the point
	PointHashLen = 32
)

Functions

func DataToPoint

func DataToPoint(data []byte) (x, y *big.Int)

DataToPoint hashes data using SHA-256 and maps it to a point on curve

func HashToPoint

func HashToPoint(hash []byte) (x, y *big.Int)

HashToPoint maps 32 byte hash to a point on curve

Types

type GF

type GF struct {
	P *big.Int
}

GF represents galois field over prime

func (*GF) Add

func (g *GF) Add(a, b *big.Int) *big.Int

Add adds two numbers over GFp

func (*GF) AddBytes

func (g *GF) AddBytes(a []byte, b *big.Int) *big.Int

AddBytes adds two numbers one of which is represented as byte array over GFp

func (*GF) Cube

func (g *GF) Cube(a *big.Int) *big.Int

Cube does a^3 over GFp

func (*GF) Div

func (g *GF) Div(a, b *big.Int) *big.Int

Div multiplies a number by an inverse of another number over GFp

func (*GF) Inv

func (g *GF) Inv(a *big.Int) *big.Int

Inv does modulo inverse over GFp

func (*GF) InvBytes

func (g *GF) InvBytes(a []byte) *big.Int

InvBytes does modulo inverse over GFp represented by a byte array

func (*GF) Mul

func (g *GF) Mul(a, b *big.Int) *big.Int

Mul multiplies two numbers over GFp

func (*GF) MulBytes

func (g *GF) MulBytes(a []byte, b *big.Int) *big.Int

MulBytes multiplies two numbers one of which is represented as a byte array over GFp

func (*GF) Neg

func (g *GF) Neg(a *big.Int) *big.Int

Neg negates number over GFp

func (*GF) NegBytes

func (g *GF) NegBytes(a []byte) *big.Int

NegBytes negates number over GFp represented by a byte array

func (*GF) Pow

func (g *GF) Pow(a, b *big.Int) *big.Int

Pow does a^b over GFp

func (*GF) Square

func (g *GF) Square(a *big.Int) *big.Int

Square does a^2 over GFp

func (*GF) Sub

func (g *GF) Sub(a, b *big.Int) *big.Int

Sub subtracts two numbers over GFp

Jump to

Keyboard shortcuts

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