pyecsca.ec.configuration module¶
Provides a way to work with and enumerate implementation configurations.
- class EnumDefine(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
Enum
- class Multiplication(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
EnumDefine
Base multiplication algorithm to use.
- TOOM_COOK = 'MUL_TOOM_COOK'¶
- KARATSUBA = 'MUL_KARATSUBA'¶
- COMBA = 'MUL_COMBA'¶
- BASE = 'MUL_BASE'¶
- class Squaring(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
EnumDefine
Base squaring algorithm to use.
- TOOM_COOK = 'SQR_TOOM_COOK'¶
- KARATSUBA = 'SQR_KARATSUBA'¶
- COMBA = 'SQR_COMBA'¶
- BASE = 'SQR_BASE'¶
- class Reduction(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
EnumDefine
Modular reduction method used.
- BARRETT = 'RED_BARRETT'¶
- MONTGOMERY = 'RED_MONTGOMERY'¶
- BASE = 'RED_BASE'¶
- class Inversion(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
EnumDefine
Inversion algorithm used.
- GCD = 'INV_GCD'¶
- EULER = 'INV_EULER'¶
- class HashType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
EnumDefine
Hash algorithm used in ECDH and ECDSA.
- NONE = 'HASH_NONE'¶
- SHA1 = 'HASH_SHA1'¶
- SHA224 = 'HASH_SHA224'¶
- SHA256 = 'HASH_SHA256'¶
- SHA384 = 'HASH_SHA384'¶
- SHA512 = 'HASH_SHA512'¶
- class RandomMod(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
EnumDefine
Method of sampling a uniform integer modulo order.
- SAMPLE = 'MOD_RAND_SAMPLE'¶
- REDUCE = 'MOD_RAND_REDUCE'¶
- class Configuration(model, coords, formulas, scalarmult, hash_type, mod_rand, mult, sqr, red, inv)[source]¶
Bases:
object
An ECC implementation configuration.
-
model:
CurveModel
¶
-
coords:
CoordinateModel
¶
-
scalarmult:
ScalarMultiplier
¶
-
mult:
Multiplication
¶
-
model:
- all_configurations(**kwargs)[source]¶
Get all implementation configurations that match the given kwargs.
The keys in
kwargs
should be some of the attributes in theConfiguration
, and the values limit the returned configurations to configuration matching them.Note
The
formulas
attribute is unsupported and formulas should be provided using thescalarmult
attribute, which is either a subclass of theScalarMultiplier
class or an instance of it or a dictionary giving arguments to a constructor of someScalarMultiplier
subclass.Warning
The returned number of configurations might be quite large and take up significant memory space. Use this generator and do not store the results.
- Parameters:
kwargs¶ – The configuration parameters to match.
- Return type:
Generator
[Configuration
,None
,None
]- Returns:
A generator of the configurations.