cunative

package
v1.23.1 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: Apache-2.0, MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(replica, key io.Reader, out io.Writer) error

func DecodeSnap

func DecodeSnap(spt abi.RegisteredSealProof, commD, commK cid.Cid, key, replica io.Reader, out io.Writer) error

Types

type B32le

type B32le = [32]byte

func Phi

func Phi(commDNew, commROld BytesLE) (B32le, error)

Phi implements the phi function as described in the Rust code. It computes phi = H(comm_d_new, comm_r_old) using Poseidon hash with a custom domain separation tag.

type BytesLE

type BytesLE = []byte

type CustomDomainSepTagElement

type CustomDomainSepTagElement struct {
	*fr.Element
}

CustomDomainSepTagElement is a custom element which overrides SetString used by the poseidon hash function to set the default hardcoded DST. We hijack the SetString function to set the DST to the hardcoded value needed for Snap.

func (*CustomDomainSepTagElement) BigInt

func (c *CustomDomainSepTagElement) BigInt(b *big.Int) *big.Int

func (*CustomDomainSepTagElement) Cmp

func (*CustomDomainSepTagElement) Inverse

func (*CustomDomainSepTagElement) Set

func (*CustomDomainSepTagElement) SetBigInt

func (*CustomDomainSepTagElement) SetBytes

func (*CustomDomainSepTagElement) SetOne

func (*CustomDomainSepTagElement) SetString

func (*CustomDomainSepTagElement) SetUint64

func (*CustomDomainSepTagElement) SetZero

func (*CustomDomainSepTagElement) Square

type Range

type Range struct {
	Start, End uint64
}

type Rhos

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

Rhos represents a collection of precomputed rho values

func NewInv

func NewInv(phi [32]byte, h uint64, nodesCount uint64) (*Rhos, error)

NewInv generates the inverted rhos for a certain number of nodes

func NewInvRange

func NewInvRange(phi [32]byte, h uint64, nodesCount, offset, num uint64) (*Rhos, error)

NewInvRange generates the inverted rhos for a certain number of nodes and range

func (*Rhos) Get

func (r *Rhos) Get(offset uint64) B32le

Get retrieves the rho for a specific node offset

Jump to

Keyboard shortcuts

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