47 lines
1.5 KiB
Go
47 lines
1.5 KiB
Go
// Copyright 2020-2025 Consensys Software Inc.
|
|
// Licensed under the Apache License, Version 2.0. See the LICENSE file for details.
|
|
|
|
// Code generated by consensys/gnark-crypto DO NOT EDIT
|
|
|
|
// Package fp contains field arithmetic operations for modulus = 0x1a0111...ffaaab.
|
|
//
|
|
// The API is similar to math/big (big.Int), but the operations are significantly faster (up to 20x).
|
|
//
|
|
// Additionally fp.Vector offers an API to manipulate []Element.
|
|
//
|
|
// The modulus is hardcoded in all the operations.
|
|
//
|
|
// Field elements are represented as an array, and assumed to be in Montgomery form in all methods:
|
|
//
|
|
// type Element [6]uint64
|
|
//
|
|
// # Usage
|
|
//
|
|
// Example API signature:
|
|
//
|
|
// // Mul z = x * y (mod q)
|
|
// func (z *Element) Mul(x, y *Element) *Element
|
|
//
|
|
// and can be used like so:
|
|
//
|
|
// var a, b Element
|
|
// a.SetUint64(2)
|
|
// b.SetString("984896738")
|
|
// a.Mul(a, b)
|
|
// a.Sub(a, a)
|
|
// .Add(a, b)
|
|
// .Inv(a)
|
|
// b.Exp(b, new(big.Int).SetUint64(42))
|
|
//
|
|
// Modulus q =
|
|
//
|
|
// q[base10] = 4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559787
|
|
// q[base16] = 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab
|
|
//
|
|
// # Warning
|
|
//
|
|
// There is no security guarantees such as constant time implementation or side-channel attack resistance.
|
|
// This code is provided as-is. Partially audited, see https://github.com/Consensys/gnark/tree/master/audits
|
|
// for more details.
|
|
package fp
|