felt

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2023 License: Apache-2.0 Imports: 6 Imported by: 106

Documentation

Index

Constants

View Source
const (
	Limbs = fp.Limbs // number of 64 bits words needed to represent a Element
	Bits  = fp.Bits  // number of bits needed to represent a Element
	Bytes = fp.Bytes // number of bytes needed to represent a Element
)

Variables

View Source
var Zero = Felt{}

zero felt constant

Functions

This section is empty.

Types

type Felt

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

func NewFelt

func NewFelt(element *fp.Element) *Felt

func (*Felt) Add

func (z *Felt) Add(x, y *Felt) *Felt

Add forwards the call to underlying field element implementation

func (*Felt) BigInt

func (z *Felt) BigInt(res *big.Int) *big.Int

BigInt forwards the call to underlying field element implementation

func (*Felt) Bits

func (z *Felt) Bits() [4]uint64

Bits forwards the call to underlying field element implementation

func (*Felt) Bytes

func (z *Felt) Bytes() [32]byte

Bytes forwards the call to underlying field element implementation

func (*Felt) Equal

func (z *Felt) Equal(x *Felt) bool

Equal forwards the call to underlying field element implementation

func (*Felt) Halve

func (z *Felt) Halve()

Halve forwards the call to underlying field element implementation

func (*Felt) Impl

func (z *Felt) Impl() *fp.Element

Impl returns the underlying field element type

func (*Felt) IsOne

func (z *Felt) IsOne() bool

IsOne forwards the call to underlying field element implementation

func (*Felt) IsZero

func (z *Felt) IsZero() bool

IsZero forwards the call to underlying field element implementation

func (*Felt) Marshal

func (z *Felt) Marshal() []byte

Marshal forwards the call to underlying field element implementation

func (*Felt) MarshalCBOR

func (z *Felt) MarshalCBOR() ([]byte, error)

MarshalCBOR lets Felt be encoded in CBOR format with private `val`

func (*Felt) MarshalJSON

func (z *Felt) MarshalJSON() ([]byte, error)

MarshalJSON forwards the call to underlying field element implementation

func (*Felt) Set

func (z *Felt) Set(x *Felt) *Felt

Set forwards the call to underlying field element implementation

func (*Felt) SetBytes

func (z *Felt) SetBytes(e []byte) *Felt

SetBytes forwards the call to underlying field element implementation

func (*Felt) SetRandom

func (z *Felt) SetRandom() (*Felt, error)

SetRandom forwards the call to underlying field element implementation

func (*Felt) SetString

func (z *Felt) SetString(number string) (*Felt, error)

SetString forwards the call to underlying field element implementation

func (*Felt) SetUint64

func (z *Felt) SetUint64(v uint64) *Felt

SetUint64 forwards the call to underlying field element implementation

func (*Felt) ShortString

func (z *Felt) ShortString() string

ShortString prints the felt to a string in a shortened format

func (*Felt) String

func (z *Felt) String() string

String forwards the call to underlying field element implementation

func (*Felt) Text

func (z *Felt) Text(base int) string

Text forwards the call to underlying field element implementation

func (*Felt) UnmarshalCBOR

func (z *Felt) UnmarshalCBOR(data []byte) error

UnmarshalCBOR lets Felt be decoded from CBOR format with private `val`

func (*Felt) UnmarshalJSON

func (z *Felt) UnmarshalJSON(data []byte) error

UnmarshalJSON accepts numbers and strings as input. See Element.SetString for valid prefixes (0x, 0b, ...). If there is an error, we try to explicitly unmarshal from hex before returning an error. This implementation is taken from gnark-crypto.

Jump to

Keyboard shortcuts

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