EltG is a group element.
type EltG interface{}
EltP is a precomputed group element.
type EltP interface{}
Encoder allows to convert integers into valid powers.
type Encoder struct {
// contains filtered or unexported fields
}
func New(t, v, w uint) (Encoder, error)
New produces an encoder of the MLSBSet algorithm.
func (m Encoder) Elts() uint
Elts returns the total number of elements that must be precomputed.
func (m Encoder) Encode(k []byte) (*Power, error)
Encode converts an odd integer k into a valid power for exponentiation.
func (m Encoder) GetParams() Params
GetParams returns the complementary parameters of the encoding.
func (m Encoder) IsExtended() bool
IsExtended returns true if the element x^(2^(wd)) must be calculated.
func (m Encoder) Ops() (S uint, M uint)
Ops returns the number of squares and multiplications executed during an exponentiation.
func (m Encoder) String() string
Group defines the operations required by MLSBSet exponentiation method.
type Group interface { Identity() EltG // Returns the identity of the group. Sqr(x EltG) // Calculates x = x^2. Mul(x EltG, y EltP) // Calculates x = x*y. NewEltP() EltP // Returns an arbitrary precomputed element. ExtendedEltP() EltP // Returns the precomputed element x^(2^(w*d)). Lookup(a EltP, v uint, s, u int32) // Sets a = s*T[v][u]. }
Params contains the parameters of the encoding.
type Params struct { T uint // T is the maximum size (in bits) of exponents. V uint // V is the number of tables. W uint // W is the window size. E uint // E is the number of digits per table. D uint // D is the number of digits in total. L uint // L is the length of the code. }
Power is a valid exponent produced by the MLSBSet encoding algorithm.
type Power struct {
// contains filtered or unexported fields
}
func (p *Power) Digit(v, e uint) (sgn, dig int32)
Digit returns the (v,e)-th digit and its sign.
func (p *Power) Exp(G Group) EltG
Exp is calculates x^k, where x is a predetermined element of a group G.
func (p *Power) String() string