package
0.0.0-20240222135501-202feaa08846
Repository: https://github.com/privacybydesign/gabi.git
Documentation: pkg.go.dev
# Functions
Close is a helper function for absorbing errors in the `defer x.Close()` pattern.
Crt finds a number x (mod pa*pb) such that x = a (mod pa) and x = b (mod pb).
FastRandomBigInt derives a random number uniformly chosen below the given limit from a random 256 bit seed generated when the application starts.
GetHashNumber uses a hash to generate random numbers of a given bit-length in the fiat-shamir heuristic.
HashCommit computes the sha256 hash over the asn1 representation of a slice of big integers and returns a positive big integer that can be represented with that hash.
IntHashSha256 is a utility function which computes the sha256 hash over a byte array and returns this hash as a big.Int.
LegendreSymbol calculates the Legendre symbol (a/p).
ModInverse returns ia, the inverse of a in the multiplicative group of prime order n.
ModPow computes x^y mod m.
ModSqrt calculates Sqrt modulo a number with given prime factors.
No description provided by the author
PrimeSqrt calculates sqrt modulo a prime.
RandomBigInt returns a random big integer value in the range [0,(2^numBits)-1], inclusive.
RandomPrimeInRange returns a random probable prime in the range [2^start, 2^start + 2^length] This code is an adaption of Go's own Prime function in rand/util.go.
No description provided by the author
RepresentToBases returns a representation of the given exponents in terms of the R bases from the public key.
SumFourSquares expresses a number as sum of four squares algorithm from "Randomized algorithms in number theory" by M.
# Variables
No description provided by the author
SmallPrimes is a list of small prime numbers that allows us to rapidly exclude some fraction of composite candidates when searching for a random prime.
SmallPrimesProduct is the product of the values in SmallPrimes and allows us to reduce a candidate prime by this number and then determine whether it's coprime with all the elements of SmallPrimes without further big.Int operations.