Documentation ¶
Index ¶
- Constants
- func AddMod384_asm(f *Field, out_bytes, x_bytes, y_bytes []byte) error
- func AddModGeneric(f *Field, zBytes, xBytes, yBytes []byte) error
- func AddModNonUnrolled1024(f *Field, out_bytes, x_bytes, y_bytes []byte) error
- func AddModNonUnrolled128(f *Field, out_bytes, x_bytes, y_bytes []byte) error
- func AddModNonUnrolled192(f *Field, out_bytes, x_bytes, y_bytes []byte) error
- func AddModNonUnrolled256(f *Field, out_bytes, x_bytes, y_bytes []byte) error
- func AddModNonUnrolled320(f *Field, out_bytes, x_bytes, y_bytes []byte) error
- func AddModNonUnrolled384(f *Field, out_bytes, x_bytes, y_bytes []byte) error
- func AddModNonUnrolled448(f *Field, out_bytes, x_bytes, y_bytes []byte) error
- func AddModNonUnrolled512(f *Field, out_bytes, x_bytes, y_bytes []byte) error
- func AddModNonUnrolled576(f *Field, out_bytes, x_bytes, y_bytes []byte) error
- func AddModNonUnrolled64(f *Field, out_bytes, x_bytes, y_bytes []byte) error
- func AddModNonUnrolled640(f *Field, out_bytes, x_bytes, y_bytes []byte) error
- func AddModNonUnrolled704(f *Field, out_bytes, x_bytes, y_bytes []byte) error
- func AddModNonUnrolled768(f *Field, out_bytes, x_bytes, y_bytes []byte) error
- func AddModNonUnrolled832(f *Field, out_bytes, x_bytes, y_bytes []byte) error
- func AddModNonUnrolled896(f *Field, out_bytes, x_bytes, y_bytes []byte) error
- func AddModNonUnrolled960(f *Field, out_bytes, x_bytes, y_bytes []byte) error
- func BytesToLimbs(val []byte) []uint64
- func BytesToNumString(val []byte) string
- func Eq(n, other []uint64) bool
- func GTE(x, y []uint64) bool
- func GenTestModulus(limbCount uint) []byte
- func IntToLimbs(val *big.Int, num_limbs uint) []uint64
- func LEBytesToInt(v []byte) *big.Int
- func LimbsEq(x, y []uint64) bool
- func LimbsToInt(limbs []uint64) *big.Int
- func LimbsToLEBytes(val []uint64) []byte
- func MaxModulus(limbCount uint) []byte
- func MidModulus(limbCount uint) []uint64
- func MontConstant_Interleaved(modulus []uint64) uint64
- func MulMont384_asm(f *Field, out_bytes, x_bytes, y_bytes []byte) error
- func MulMontNonInterleaved(m *Field, zBytes, xBytes, yBytes []byte) error
- func MulMontNonUnrolled1024(ctx *Field, z_bytes, x_bytes, y_bytes []byte) error
- func MulMontNonUnrolled128(ctx *Field, z_bytes, x_bytes, y_bytes []byte) error
- func MulMontNonUnrolled192(ctx *Field, z_bytes, x_bytes, y_bytes []byte) error
- func MulMontNonUnrolled256(ctx *Field, z_bytes, x_bytes, y_bytes []byte) error
- func MulMontNonUnrolled320(ctx *Field, z_bytes, x_bytes, y_bytes []byte) error
- func MulMontNonUnrolled384(ctx *Field, z_bytes, x_bytes, y_bytes []byte) error
- func MulMontNonUnrolled448(ctx *Field, z_bytes, x_bytes, y_bytes []byte) error
- func MulMontNonUnrolled512(ctx *Field, z_bytes, x_bytes, y_bytes []byte) error
- func MulMontNonUnrolled576(ctx *Field, z_bytes, x_bytes, y_bytes []byte) error
- func MulMontNonUnrolled64(ctx *Field, z_bytes, x_bytes, y_bytes []byte) error
- func MulMontNonUnrolled640(ctx *Field, z_bytes, x_bytes, y_bytes []byte) error
- func MulMontNonUnrolled704(ctx *Field, z_bytes, x_bytes, y_bytes []byte) error
- func MulMontNonUnrolled768(ctx *Field, z_bytes, x_bytes, y_bytes []byte) error
- func MulMontNonUnrolled832(ctx *Field, z_bytes, x_bytes, y_bytes []byte) error
- func MulMontNonUnrolled896(ctx *Field, z_bytes, x_bytes, y_bytes []byte) error
- func MulMontNonUnrolled960(ctx *Field, z_bytes, x_bytes, y_bytes []byte) error
- func One(limbCount uint) []uint64
- func PadBytes(val []byte, size uint64) []byte
- func PadBytes8(val []byte) []byte
- func RSquared(modulus []uint64) []uint64
- func SmolModulus(limbCount uint) []byte
- func SubMod384_asm(f *Field, out_bytes, x_bytes, y_bytes []byte) error
- func SubModGeneric(f *Field, zBytes, xBytes, yBytes []byte) error
- func SubModNonUnrolled1024(f *Field, out_bytes, x_bytes, y_bytes []byte) error
- func SubModNonUnrolled128(f *Field, out_bytes, x_bytes, y_bytes []byte) error
- func SubModNonUnrolled192(f *Field, out_bytes, x_bytes, y_bytes []byte) error
- func SubModNonUnrolled256(f *Field, out_bytes, x_bytes, y_bytes []byte) error
- func SubModNonUnrolled320(f *Field, out_bytes, x_bytes, y_bytes []byte) error
- func SubModNonUnrolled384(f *Field, out_bytes, x_bytes, y_bytes []byte) error
- func SubModNonUnrolled448(f *Field, out_bytes, x_bytes, y_bytes []byte) error
- func SubModNonUnrolled512(f *Field, out_bytes, x_bytes, y_bytes []byte) error
- func SubModNonUnrolled576(f *Field, out_bytes, x_bytes, y_bytes []byte) error
- func SubModNonUnrolled64(f *Field, out_bytes, x_bytes, y_bytes []byte) error
- func SubModNonUnrolled640(f *Field, out_bytes, x_bytes, y_bytes []byte) error
- func SubModNonUnrolled704(f *Field, out_bytes, x_bytes, y_bytes []byte) error
- func SubModNonUnrolled768(f *Field, out_bytes, x_bytes, y_bytes []byte) error
- func SubModNonUnrolled832(f *Field, out_bytes, x_bytes, y_bytes []byte) error
- func SubModNonUnrolled896(f *Field, out_bytes, x_bytes, y_bytes []byte) error
- func SubModNonUnrolled960(f *Field, out_bytes, x_bytes, y_bytes []byte) error
- type ArithPreset
- type Field
- func (m *Field) ModInv() *big.Int
- func (m *Field) ModIsSet() bool
- func (m *Field) RInv() *big.Int
- func (m *Field) RSquared() []byte
- func (m *Field) RVal() *big.Int
- func (m *Field) SetMod(mod []byte) error
- func (m *Field) ToMont(val []byte) ([]byte, error)
- func (m *Field) ToNorm(val []byte) ([]byte, error)
Constants ¶
View Source
const MaxInputSize = 16
TODO increase this once we figure out what the cap will be
Variables ¶
This section is empty.
Functions ¶
func AddMod384_asm ¶
func AddModGeneric ¶
func AddModNonUnrolled1024 ¶
func AddModNonUnrolled128 ¶
func AddModNonUnrolled192 ¶
func AddModNonUnrolled256 ¶
func AddModNonUnrolled320 ¶
func AddModNonUnrolled384 ¶
func AddModNonUnrolled448 ¶
func AddModNonUnrolled512 ¶
func AddModNonUnrolled576 ¶
func AddModNonUnrolled64 ¶
func AddModNonUnrolled640 ¶
func AddModNonUnrolled704 ¶
func AddModNonUnrolled768 ¶
func AddModNonUnrolled832 ¶
func AddModNonUnrolled896 ¶
func AddModNonUnrolled960 ¶
func BytesToLimbs ¶
func BytesToNumString ¶
func GenTestModulus ¶
utility for unit testing. returns (1 << (((limbCount - 1) * limbBits) + limbBits / 2)) - 1
func IntToLimbs ¶
convert big.Int (big-endian) to big-endian limbs
func LEBytesToInt ¶
Methods for converting between Go big-int (64bit little-endian limbs, big-endian limb ordering) and the bigint representation expected here: 64bit little-endian limbs, little-endian ordered
func LimbsToLEBytes ¶
func MaxModulus ¶
func MidModulus ¶
func MontConstant_Interleaved ¶
does the Python equivalent of pow(-modulus, -1, 1<<64)
func MulMont384_asm ¶
func MulMontNonInterleaved ¶
func MulMontNonUnrolled1024 ¶
func MulMontNonUnrolled128 ¶
func MulMontNonUnrolled192 ¶
func MulMontNonUnrolled256 ¶
func MulMontNonUnrolled320 ¶
func MulMontNonUnrolled384 ¶
func MulMontNonUnrolled448 ¶
func MulMontNonUnrolled512 ¶
func MulMontNonUnrolled576 ¶
func MulMontNonUnrolled64 ¶
func MulMontNonUnrolled640 ¶
func MulMontNonUnrolled704 ¶
func MulMontNonUnrolled768 ¶
func MulMontNonUnrolled832 ¶
func MulMontNonUnrolled896 ¶
func MulMontNonUnrolled960 ¶
func SmolModulus ¶
func SubMod384_asm ¶
func SubModGeneric ¶
func SubModNonUnrolled1024 ¶
func SubModNonUnrolled128 ¶
func SubModNonUnrolled192 ¶
func SubModNonUnrolled256 ¶
func SubModNonUnrolled320 ¶
func SubModNonUnrolled384 ¶
func SubModNonUnrolled448 ¶
func SubModNonUnrolled512 ¶
func SubModNonUnrolled576 ¶
func SubModNonUnrolled64 ¶
func SubModNonUnrolled640 ¶
func SubModNonUnrolled704 ¶
func SubModNonUnrolled768 ¶
func SubModNonUnrolled832 ¶
func SubModNonUnrolled896 ¶
func SubModNonUnrolled960 ¶
Types ¶
type ArithPreset ¶
type ArithPreset struct { AddModImpls []arithFunc SubModImpls []arithFunc MulMontImpls []arithFunc // contains filtered or unexported fields }
func AllPresets ¶
func AllPresets() []ArithPreset
func Asm384Preset ¶
func Asm384Preset() ArithPreset
Preset same as default except it uses blst's go-asm impl of the arithmetic at 384bit widths
func DefaultPreset ¶
func DefaultPreset() ArithPreset
func GenericMulMontPreset ¶
func GenericMulMontPreset() ArithPreset
func NonUnrolledPreset ¶
func NonUnrolledPreset() ArithPreset
func (*ArithPreset) MaxLimbCount ¶
func (a *ArithPreset) MaxLimbCount() uint
type Field ¶
type Field struct { // TODO make most of these private and the arith operations methods of this struct Modulus []byte ModulusNonInterleaved *big.Int // just here for convenience XXX better naming ModulusLimbs []uint64 MontParamInterleaved uint64 MontParamNonInterleaved *big.Int NumLimbs uint MulMont arithFunc AddMod arithFunc SubMod arithFunc MulMontCost uint64 AddModCost uint64 SubModCost uint64 SetModCost uint64 ElementSize uint64 // contains filtered or unexported fields }
TODO rename to Context
func NewField ¶
func NewField(preset ArithPreset) *Field
func (*Field) SetMod ¶
compute montgomery parameters given big-endian modulus bytes. don't pad the input bytes
Source Files ¶
Click to show internal directories.
Click to hide internal directories.