package mlsbset
import "github.com/cloudflare/circl/math/mlsbset"
Package mlsbset provides a constant-time exponentiation method with precomputation.
References: "Efficient and secure algorithms for GLV-based scalar multiplication and their implementation on GLV–GLS curves" by (Faz-Hernandez et al.)
Index ¶
- type EltG
- type EltP
- type Encoder
- func New(t, v, w uint) (Encoder, error)
- func (m Encoder) Elts() uint
- func (m Encoder) Encode(k []byte) (*Power, error)
- func (m Encoder) GetParams() Params
- func (m Encoder) IsExtended() bool
- func (m Encoder) Ops() (S uint, M uint)
- func (m Encoder) String() string
- type Group
- type Params
- type Power
Types ¶
type EltG ¶
type EltG interface{}
EltG is a group element.
type EltP ¶
type EltP interface{}
EltP is a precomputed group element.
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder allows to convert integers into valid powers.
func New ¶
New produces an encoder of the MLSBSet algorithm.
func (Encoder) Elts ¶
Elts returns the total number of elements that must be precomputed.
func (Encoder) Encode ¶
Encode converts an odd integer k into a valid power for exponentiation.
func (Encoder) GetParams ¶
GetParams returns the complementary parameters of the encoding.
func (Encoder) IsExtended ¶
IsExtended returns true if the element x^(2^(wd)) must be calculated.
func (Encoder) Ops ¶
Ops returns the number of squares and multiplications executed during an exponentiation.
func (Encoder) String ¶
type Group ¶
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]. }
Group defines the operations required by MLSBSet exponentiation method.
type Params ¶
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. }
Params contains the parameters of the encoding.
type Power ¶
type Power struct {
// contains filtered or unexported fields
}
Power is a valid exponent produced by the MLSBSet encoding algorithm.
func (*Power) Digit ¶
Digit returns the (v,e)-th digit and its sign.
func (*Power) Exp ¶
Exp is calculates x^k, where x is a predetermined element of a group G.
func (*Power) String ¶
Source Files ¶
- Version
- v1.6.1 (latest)
- Published
- Apr 9, 2025
- Platform
- linux/amd64
- Imports
- 4 packages
- Last checked
- 1 week ago –
Tools for package owners.