felt

package
v0.11.7 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 6 Imported by: 106

Documentation

Index

Constants

View Source
const (
	Base16 = 16
	Base10 = 10
)
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) Clone added in v0.9.3

func (z *Felt) Clone() *Felt

func (*Felt) Cmp added in v0.2.1

func (z *Felt) Cmp(x *Felt) int

Cmp forwards the call to underlying field element implementation

func (*Felt) Div added in v0.6.0

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

Div forwards the call to underlying field element implementation

func (*Felt) Double added in v0.2.1

func (z *Felt) Double(x *Felt) *Felt

Double 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) Exp added in v0.2.1

func (z *Felt) Exp(x *Felt, y *big.Int) *Felt

Exp 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) Mul added in v0.2.1

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

Mul 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) SetBigInt added in v0.4.0

func (z *Felt) SetBigInt(v *big.Int) *Felt

SetBigInt 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) Sub added in v0.2.1

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

Sub 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) Uint64 added in v0.4.0

func (z *Felt) Uint64() uint64

Uint64 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 based on gnark-crypto's UnmarshalJSON.

Jump to

Keyboard shortcuts

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