Documentation ¶
Overview ¶
Package dlog includes algorithms for computing discrete logarithms.
FE schemes instantiated from the Discrete Diffie-Hellman assumption (DDH) all rely on efficient algorithms for calculating discrete logarithms.
Index ¶
Constants ¶
This section is empty.
Variables ¶
MaxBound limits the interval of values that are checked when computing discrete logarithms. It prevents time and memory exhaustive computation for practical purposes. If Calc is configured to use a boundary value > MaxBound, it will be automatically adjusted to MaxBound.
Functions ¶
This section is empty.
Types ¶
type Calc ¶
type Calc struct{}
Calc represents a discrete logarithm calculator.
type CalcBN256 ¶
CalcBN256 represents a calculator for discrete logarithms that operates in the BN256 group.
func (*CalcBN256) BabyStepGiantStep ¶
BabyStepGiantStep uses the baby-step giant-step method to compute the discrete logarithm in the BN256.GT group. If c.neg is set to true it searches for the answer within [-bound, bound]. It does so by running two goroutines, one for negative answers and one for positive. If c.neg is set to false only one goroutine is started, searching for the answer within [0, bound].
func (*CalcBN256) BabyStepGiantStepStd ¶
BabyStepGiantStepStd implements the baby-step giant-step method to compute the discrete logarithm in the BN256.GT group.
It searches for a solution <= bound. If bound argument is nil, the bound is automatically set to the hard coded MaxBound.
The function returns x, where h = g^x in BN256.GT group where operations are written as multiplications. If the solution was not found within the provided bound, it returns an error.
func (*CalcBN256) Precompute ¶
Precompute precomputes small steps for the discrete logarithm search. The resulting precomputation table is of size 2^maxBits.
type CalcZp ¶
type CalcZp struct {
// contains filtered or unexported fields
}
CalcZp represents a calculator for discrete logarithms that operates in the Zp group of integers modulo prime p.
func (*CalcZp) BabyStepGiantStep ¶
BabyStepGiantStep uses the baby-step giant-step method to compute the discrete logarithm in the Zp group. If c.neg is set to true it searches for the answer within [-bound, bound]. It does so by running two goroutines, one for negative answers and one for positive. If c.neg is set to false only one goroutine is started, searching for the answer within [0, bound].