mlsag

package
v0.0.0-...-7ece11e Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

variable names to match names in the crypto protocol Package mlsag contains the implementation of MLSAG, a ring signature scheme.

variable names to match names in the crypto protocol

variable names to match names in the crypto protocol

Index

Constants

View Source
const (
	MlsagPrefix = byte(0x2)
	MaxSizeByte = (1 << 8) - 1
)

Variables

This section is empty.

Functions

func ParseKeyImages

func ParseKeyImages(privateKeys []*operation.Scalar) []*operation.Point

func ParseKeyImagesCA

func ParseKeyImagesCA(privateKeys []*operation.Scalar) []*operation.Point

func Verify

func Verify(sig *Sig, K *Ring, message []byte) (bool, error)

Verify does verification of a ring signature on a message.

func VerifyConfidentialAsset

func VerifyConfidentialAsset(sig *Sig, K *Ring, message []byte) (bool, error)

VerifyConfidentialAsset does verification of a (Confidential Asset) ring signature on a message.

Types

type Mlsag

type Mlsag struct {
	R *Ring
	// contains filtered or unexported fields
}

Mlsag struct contains the data needed to sign a Ring.

pi : the row index of the "real" coins

func NewMlsag

func NewMlsag(privateKeys []*operation.Scalar, R *Ring, pi int) *Mlsag

func NewMlsagCA

func NewMlsagCA(privateKeys []*operation.Scalar, R *Ring, pi int) *Mlsag

func (*Mlsag) Sign

func (mlsag *Mlsag) Sign(message []byte) (*Sig, error)

Sign uses the private key in this Mlsag to sign a message (which is the transaction hash). It returns a Sig.

func (*Mlsag) SignConfidentialAsset

func (mlsag *Mlsag) SignConfidentialAsset(message []byte) (*Sig, error)

SignConfidentialAsset uses the private key in this Mlsag to sign a message (which is the transaction hash). It returns a mlsag.Sig.

The Ring for Confidential Asset transactions has one extra column; it contains the asset tag sums.

type Ring

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

Ring is the struct for a MLSAG ring. It is a matrix of public keys. One of these rows is the actual coin transfer, others consist of "decoy" public keys from the chain data.

func NewRandomRing

func NewRandomRing(privateKeys []*operation.Scalar, numFake, pi int) (K *Ring)

NewRandomRing creates a random ring with dimension: (numFake; len(privateKeys)) where we generate fake public keys inside

func NewRing

func NewRing(keys [][]*operation.Point) *Ring

func (*Ring) FromBytes

func (ring *Ring) FromBytes(b []byte) (*Ring, error)

FromBytes decodes a byte array into a Ring

func (Ring) GetKeys

func (ring Ring) GetKeys() [][]*operation.Point

GetKeys returns the public keys in this Ring as a 2-dimensional array

func (Ring) ToBytes

func (ring Ring) ToBytes() ([]byte, error)

ToBytes encodes this Ring's dimensions & contents into a byte array.

type Sig

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

Sig is the ring signature that appears on transactions.

func NewMlsagSig

func NewMlsagSig(c *operation.Scalar, keyImages []*operation.Point, r [][]*operation.Scalar) (*Sig, error)

func (*Sig) FromBytes

func (sig *Sig) FromBytes(b []byte) (*Sig, error)

Get from byte and store to signature

func (Sig) GetC

func (sig Sig) GetC() *operation.Scalar

func (Sig) GetKeyImages

func (sig Sig) GetKeyImages() []*operation.Point

func (Sig) GetR

func (sig Sig) GetR() [][]*operation.Scalar

func (*Sig) SetC

func (sig *Sig) SetC(c *operation.Scalar)

func (*Sig) SetKeyImages

func (sig *Sig) SetKeyImages(keyImages []*operation.Point)

func (*Sig) SetR

func (sig *Sig) SetR(r [][]*operation.Scalar)

func (*Sig) ToBytes

func (sig *Sig) ToBytes() ([]byte, error)

Jump to

Keyboard shortcuts

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