emparams

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package emparams contains emulation parameters for well known fields.

We define some well-known parameters in this package for compatibility and ease of use. When needing to use parameters not defined in this package it is sufficient to define a new type implementing [FieldParams]. For example, as:

type SmallField struct {}
func (SmallField) NbLimbs() uint { return 1 }
func (SmallField) BitsPerLimb() uint { return 11 }
func (SmallField) IsPrime() bool { return true }
func (SmallField) Modulus() *big.Int { return big.NewInt(1032) }

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BLS12377Fp

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

BLS12377Fp provides type parametrization for field emulation:

  • limbs: 6
  • limb width: 64 bits

The prime modulus for type parametrisation is:

0x1ae3a4617c510eac63b05c06ca1493b1a22d9f300f5138f1ef3622fba094800170b5d44300000008508c00000000001 (base 16)
258664426012969094010652733694893533536393512754914660539884262666720468348340822774968888139573360124440321458177 (base 10)

This is the base field of the BLS12-377 curve.

func (BLS12377Fp) BitsPerLimb

func (BLS12377Fp) BitsPerLimb() uint

func (BLS12377Fp) IsPrime

func (BLS12377Fp) IsPrime() bool

func (BLS12377Fp) Modulus

func (fp BLS12377Fp) Modulus() *big.Int

func (BLS12377Fp) NbLimbs

func (BLS12377Fp) NbLimbs() uint

type BLS12377Fr

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

BLS12377Fr provides type parametrization for field emulation:

  • limbs: 4
  • limb width: 64 bits

The prime modulus for type parametrisation is:

0x12ab655e9a2ca55660b44d1e5c37b00159aa76fed00000010a11800000000001 (base 16)
8444461749428370424248824938781546531375899335154063827935233455917409239041 (base 10)

This is the scalar field of the BLS12-377 curve.

func (BLS12377Fr) BitsPerLimb

func (BLS12377Fr) BitsPerLimb() uint

func (BLS12377Fr) IsPrime

func (BLS12377Fr) IsPrime() bool

func (BLS12377Fr) Modulus

func (fr BLS12377Fr) Modulus() *big.Int

func (BLS12377Fr) NbLimbs

func (BLS12377Fr) NbLimbs() uint

type BLS12381Fp

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

BLS12381Fp provides type parametrization for field emulation:

  • limbs: 6
  • limb width: 64 bits

The prime modulus for type parametrisation is:

0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab (base 16)
4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559787 (base 10)

This is the base field of the BLS12-381 curve.

func (BLS12381Fp) BitsPerLimb

func (BLS12381Fp) BitsPerLimb() uint

func (BLS12381Fp) IsPrime

func (BLS12381Fp) IsPrime() bool

func (BLS12381Fp) Modulus

func (fp BLS12381Fp) Modulus() *big.Int

func (BLS12381Fp) NbLimbs

func (BLS12381Fp) NbLimbs() uint

type BLS12381Fr

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

BLS12381Fr provides type parametrization for field emulation:

  • limbs: 4
  • limb width: 64 bits

The prime modulus for type parametrisation is:

0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001 (base 16)
52435875175126190479447740508185965837690552500527637822603658699938581184513 (base 10)

This is the scalar field of the BLS12-381 curve.

func (BLS12381Fr) BitsPerLimb

func (BLS12381Fr) BitsPerLimb() uint

func (BLS12381Fr) IsPrime

func (BLS12381Fr) IsPrime() bool

func (BLS12381Fr) Modulus

func (fp BLS12381Fr) Modulus() *big.Int

func (BLS12381Fr) NbLimbs

func (BLS12381Fr) NbLimbs() uint

type BLS24315Fp

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

BLS24315Fp provides type parametrization for field emulation:

  • limbs: 5
  • limb width: 64 bits

The prime modulus for type parametrisation is:

0x4c23a02b586d650d3f7498be97c5eafdec1d01aa27a1ae0421ee5da52bde5026fe802ff40300001 (base 16)
39705142709513438335025689890408969744933502416914749335064285505637884093126342347073617133569 (base 10)

This is the base field of the BLS24-315 curve.

func (BLS24315Fp) BitsPerLimb

func (BLS24315Fp) BitsPerLimb() uint

func (BLS24315Fp) IsPrime

func (BLS24315Fp) IsPrime() bool

func (BLS24315Fp) Modulus

func (fp BLS24315Fp) Modulus() *big.Int

func (BLS24315Fp) NbLimbs

func (BLS24315Fp) NbLimbs() uint

type BLS24315Fr

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

BLS24315Fr provides type parametrization for field emulation:

  • limbs: 4
  • limb width: 64 bits

The prime modulus for type parametrisation is:

11502027791375260645628074404575422495959608200132055716665986169834464870401 (base 16)
0x196deac24a9da12b25fc7ec9cf927a98c8c480ece644e36419d0c5fd00c00001 (base 10)

This is the scalar field of the BLS24-315 curve.

func (BLS24315Fr) BitsPerLimb

func (BLS24315Fr) BitsPerLimb() uint

func (BLS24315Fr) IsPrime

func (BLS24315Fr) IsPrime() bool

func (BLS24315Fr) Modulus

func (fr BLS24315Fr) Modulus() *big.Int

func (BLS24315Fr) NbLimbs

func (BLS24315Fr) NbLimbs() uint

type BN254Fp

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

BN254Fp provides type parametrization for field emulation:

  • limbs: 4
  • limb width: 64 bits

The prime modulus for type parametrisation is:

0x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47 (base 16)
21888242871839275222246405745257275088696311157297823662689037894645226208583 (base 10)

This is the base field of the BN254 curve.

func (BN254Fp) BitsPerLimb

func (BN254Fp) BitsPerLimb() uint

func (BN254Fp) IsPrime

func (BN254Fp) IsPrime() bool

func (BN254Fp) Modulus

func (fp BN254Fp) Modulus() *big.Int

func (BN254Fp) NbLimbs

func (BN254Fp) NbLimbs() uint

type BN254Fr

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

BN254Fr provides type parametrization for field emulation:

  • limbs: 4
  • limb width: 64 bits

The prime modulus for type parametrisation is:

0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001 (base 16)
21888242871839275222246405745257275088548364400416034343698204186575808495617 (base 10)

This is the scalar field of the BN254 curve.

func (BN254Fr) BitsPerLimb

func (BN254Fr) BitsPerLimb() uint

func (BN254Fr) IsPrime

func (BN254Fr) IsPrime() bool

func (BN254Fr) Modulus

func (fp BN254Fr) Modulus() *big.Int

func (BN254Fr) NbLimbs

func (BN254Fr) NbLimbs() uint

type BW6761Fp

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

BW6761Fp provides type parametrization for field emulation:

  • limbs: 12
  • limb width: 64 bits

The prime modulus for type parametrisation is:

0x122e824fb83ce0ad187c94004faff3eb926186a81d14688528275ef8087be41707ba638e584e91903cebaff25b423048689c8ed12f9fd9071dcd3dc73ebff2e98a116c25667a8f8160cf8aeeaf0a437e6913e6870000082f49d00000000008b (base 16)
6891450384315732539396789682275657542479668912536150109513790160209623422243491736087683183289411687640864567753786613451161759120554247759349511699125301598951605099378508850372543631423596795951899700429969112842764913119068299 (base 10)

This is the base field of the BW6-761 curve.

func (BW6761Fp) BitsPerLimb

func (BW6761Fp) BitsPerLimb() uint

func (BW6761Fp) IsPrime

func (BW6761Fp) IsPrime() bool

func (BW6761Fp) Modulus

func (fp BW6761Fp) Modulus() *big.Int

func (BW6761Fp) NbLimbs

func (BW6761Fp) NbLimbs() uint

type BW6761Fr

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

BW6761Fr provides type parametrization for field emulation:

  • limbs: 6
  • limb width: 64 bits

The prime modulus for type parametrisation is:

0x1ae3a4617c510eac63b05c06ca1493b1a22d9f300f5138f1ef3622fba094800170b5d44300000008508c00000000001 (base 16)
258664426012969094010652733694893533536393512754914660539884262666720468348340822774968888139573360124440321458177 (base 10)

This is the scalar field of the BW6-761 curve.

func (BW6761Fr) BitsPerLimb

func (BW6761Fr) BitsPerLimb() uint

func (BW6761Fr) IsPrime

func (BW6761Fr) IsPrime() bool

func (BW6761Fr) Modulus

func (fp BW6761Fr) Modulus() *big.Int

func (BW6761Fr) NbLimbs

func (BW6761Fr) NbLimbs() uint

type Goldilocks

type Goldilocks struct{}

Goldilocks provides type parametrization for field emulation:

  • limbs: 1
  • limb width: 64 bits

The prime modulus for type parametrisation is:

0xffffffff00000001 (base 16)
18446744069414584321 (base 10)

func (Goldilocks) BitsPerLimb

func (fp Goldilocks) BitsPerLimb() uint

func (Goldilocks) IsPrime

func (fp Goldilocks) IsPrime() bool

func (Goldilocks) Modulus

func (fp Goldilocks) Modulus() *big.Int

func (Goldilocks) NbLimbs

func (fp Goldilocks) NbLimbs() uint

type Mod1e4096

type Mod1e4096 struct{}

Mod1e4096 provides type parametrization for emulated aritmetic:

  • limbs: 64
  • limb width: 64 bits

The modulus for type parametrisation is 2^4096-1.

This is non-prime modulus. It is mainly targeted for using variable-modulus operations (ModAdd, ModMul, ModExp, ModAssertIsEqual) for variable modulus arithmetic.

func (Mod1e4096) BitsPerLimb

func (Mod1e4096) BitsPerLimb() uint

func (Mod1e4096) IsPrime

func (Mod1e4096) IsPrime() bool

func (Mod1e4096) Modulus

func (Mod1e4096) Modulus() *big.Int

func (Mod1e4096) NbLimbs

func (Mod1e4096) NbLimbs() uint

type Mod1e512

type Mod1e512 struct{}

Mod1e512 provides type parametrization for emulated aritmetic:

  • limbs: 8
  • limb width: 64 bits

The modulus for type parametrisation is 2^512-1.

This is non-prime modulus. It is mainly targeted for using variable-modulus operations (ModAdd, ModMul, ModExp, ModAssertIsEqual) for variable modulus arithmetic.

func (Mod1e512) BitsPerLimb

func (Mod1e512) BitsPerLimb() uint

func (Mod1e512) IsPrime

func (Mod1e512) IsPrime() bool

func (Mod1e512) Modulus

func (Mod1e512) Modulus() *big.Int

func (Mod1e512) NbLimbs

func (Mod1e512) NbLimbs() uint

type P256Fp

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

P256Fp provides type parametrization for field emulation:

  • limbs: 4
  • limb width: 64 bits

The prime modulus for type parametrisation is:

0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff (base 16)
115792089210356248762697446949407573530086143415290314195533631308867097853951 (base 10)

This is the base field of the P-256 (also SECP256r1) curve.

func (P256Fp) BitsPerLimb

func (P256Fp) BitsPerLimb() uint

func (P256Fp) IsPrime

func (P256Fp) IsPrime() bool

func (P256Fp) Modulus

func (P256Fp) Modulus() *big.Int

func (P256Fp) NbLimbs

func (P256Fp) NbLimbs() uint

type P256Fr

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

P256Fr provides type parametrization for field emulation:

  • limbs: 4
  • limb width: 64 bits

The prime modulus for type parametrisation is:

0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551 (base 16)
115792089210356248762697446949407573529996955224135760342422259061068512044369 (base 10)

This is the base field of the P-256 (also SECP256r1) curve.

func (P256Fr) BitsPerLimb

func (P256Fr) BitsPerLimb() uint

func (P256Fr) IsPrime

func (P256Fr) IsPrime() bool

func (P256Fr) Modulus

func (P256Fr) Modulus() *big.Int

func (P256Fr) NbLimbs

func (P256Fr) NbLimbs() uint

type P384Fp

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

P384Fp provides type parametrization for field emulation:

  • limbs: 6
  • limb width: 64 bits

The prime modulus for type parametrisation is:

0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff (base 16)
39402006196394479212279040100143613805079739270465446667948293404245721771496870329047266088258938001861606973112319 (base 10)

This is the base field of the P-384 (also SECP384r1) curve.

func (P384Fp) BitsPerLimb

func (P384Fp) BitsPerLimb() uint

func (P384Fp) IsPrime

func (P384Fp) IsPrime() bool

func (P384Fp) Modulus

func (P384Fp) Modulus() *big.Int

func (P384Fp) NbLimbs

func (P384Fp) NbLimbs() uint

type P384Fr

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

P384Fr provides type parametrization for field emulation:

  • limbs: 6
  • limb width: 64 bits

The prime modulus for type parametrisation is:

0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973 (base 16)
39402006196394479212279040100143613805079739270465446667946905279627659399113263569398956308152294913554433653942643 (base 10)

This is the scalar field of the P-384 (also SECP384r1) curve.

func (P384Fr) BitsPerLimb

func (P384Fr) BitsPerLimb() uint

func (P384Fr) IsPrime

func (P384Fr) IsPrime() bool

func (P384Fr) Modulus

func (P384Fr) Modulus() *big.Int

func (P384Fr) NbLimbs

func (P384Fr) NbLimbs() uint

type Secp256k1Fp

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

Secp256k1Fp provides type parametrization for field emulation:

  • limbs: 4
  • limb width: 64 bits

The prime modulus for type parametrisation is:

0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f (base 16)
115792089237316195423570985008687907853269984665640564039457584007908834671663 (base 10)

This is the base field of the SECP256k1 curve.

func (Secp256k1Fp) BitsPerLimb

func (Secp256k1Fp) BitsPerLimb() uint

func (Secp256k1Fp) IsPrime

func (Secp256k1Fp) IsPrime() bool

func (Secp256k1Fp) Modulus

func (fp Secp256k1Fp) Modulus() *big.Int

func (Secp256k1Fp) NbLimbs

func (Secp256k1Fp) NbLimbs() uint

type Secp256k1Fr

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

Secp256k1Fr provides type parametrization for field emulation:

  • limbs: 4
  • limb width: 64 bits

The prime modulus for type parametrisation is:

0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141 (base 16)
115792089237316195423570985008687907852837564279074904382605163141518161494337 (base 10)

This is the scalar field of the SECP256k1 curve.

func (Secp256k1Fr) BitsPerLimb

func (Secp256k1Fr) BitsPerLimb() uint

func (Secp256k1Fr) IsPrime

func (Secp256k1Fr) IsPrime() bool

func (Secp256k1Fr) Modulus

func (fp Secp256k1Fr) Modulus() *big.Int

func (Secp256k1Fr) NbLimbs

func (Secp256k1Fr) NbLimbs() uint

Jump to

Keyboard shortcuts

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