Skip to content

Commit

Permalink
docs: describe secp256k1 fields
Browse files Browse the repository at this point in the history
  • Loading branch information
ivokub committed Sep 21, 2022
1 parent 4b491c9 commit 60e1872
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions std/math/emulated/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,19 @@ func (fp Goldilocks) BitsPerLimb() uint { return 64 }
func (fp Goldilocks) IsPrime() bool { return true }
func (fp Goldilocks) Modulus() *big.Int { return qGoldilocks }

// Secp256k1 provide type parametrization for emulated field on 8 limb of width 32bits
// for modulus 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f
// Secp256k1 provide type parametrization for emulated field on 4 limb of width 64bits
// for modulus 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f.
// This is the base field of secp256k1 curve
type Secp256k1 struct{}

func (fp Secp256k1) NbLimbs() uint { return 4 }
func (fp Secp256k1) BitsPerLimb() uint { return 64 }
func (fp Secp256k1) IsPrime() bool { return true }
func (fp Secp256k1) Modulus() *big.Int { return qSecp256k1 }

// Secp256k1Scalars provides type parametrization for emulated field on 4 limbs of width 64bits
// for modulus 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141.
// This is the scalar field of secp256k1 curve.
type Secp256k1Scalars struct{}

func (fp Secp256k1Scalars) NbLimbs() uint { return 4 }
Expand Down

0 comments on commit 60e1872

Please sign in to comment.