Documentation ¶
Index ¶
- func ConcatenateNumbers(numbers ...*big.Int) []byte
- func Contains(arr []int, el int) bool
- func Exponentiate(x, y, m *big.Int) *big.Int
- func GetGermainPrime(bits int) (p *big.Int)
- func GetRandomInt(max *big.Int) *big.Int
- func GetRandomIntAlsoNeg(max *big.Int) *big.Int
- func GetRandomIntFromRange(min, max *big.Int) (*big.Int, error)
- func GetRandomIntOfLength(bitLength int) *big.Int
- func GetRandomZnInvertibleElement(n *big.Int) *big.Int
- func GetSafePrime(bits int) (p *big.Int, err error)
- func Hash(numbers ...*big.Int) *big.Int
- func HashIntoBytes(numbers ...*big.Int) []byte
- func LCM(x, y *big.Int) *big.Int
- func LagrangeInterpolation(a *big.Int, points map[*big.Int]*big.Int, prime *big.Int) *big.Int
- type Pair
- type Polynomial
- type Triple
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConcatenateNumbers ¶
It takes big.Int numbers, transform them to bytes, and concatenate the bytes.
func Exponentiate ¶
It computes x^y mod m. Negative y are supported.
func GetGermainPrime ¶
GetGermainPrime returns a prime number p for which 2*p + 1 is also prime. Note that conversely p is called safe prime.
func GetRandomInt ¶
GetRandomInt returns random integer from [0, max).
func GetRandomIntAlsoNeg ¶
GetRandomIntAlsoNeg returns random integer from (-max, max).
func GetRandomIntFromRange ¶
Returns random integer from [min, max).
func GetRandomIntOfLength ¶
GetRandomIntOfLength returns random *big.Int exactly of length bitLengh.
func GetRandomZnInvertibleElement ¶
GetZnInvertibleElement returns random element from Z_n*.
func GetSafePrime ¶
GetSafePrime returns a safe prime p (p = 2*p1 + 2 where p1 is prime too).
func HashIntoBytes ¶
It concatenates numbers (their bytes), computes a hash and outputs a hash as []byte.
Types ¶
type Pair ¶
Pair is the same as ECGroupElement, but to be used in non EC schemes when a pair of *big.Int is needed.
type Polynomial ¶
type Polynomial struct {
// contains filtered or unexported fields
}
Polynomial with coefficients in Z_prime. Coefficients are given as [a_0, a_1, ..., a_degree] where polynomial is p(x) = a_0 + a_1 * x + ... + a_degree * x^degree
func NewRandomPolynomial ¶
func NewRandomPolynomial(degree int, prime *big.Int) (*Polynomial, error)
func (*Polynomial) GetValue ¶
func (polynomial *Polynomial) GetValue(point *big.Int) *big.Int
Computes polynomial values at given point.
func (*Polynomial) SetCoefficient ¶
func (polynomial *Polynomial) SetCoefficient(coeff_ind int, coefficient *big.Int)