Module BIG
Big Number Arithmetic (BIG)
Base arithmetical operations on big numbers.
Most operators are overloaded and can be used on BIG numbers as if they would be natural. Multiplications by ECP curve points are also possible using ECP as first argument.
For explanations and example usage see dev.zenroom.org/crypto.
Info:
- Copyright: Dyne.org foundation 2017-2018
- License: AGPLv3
- Author: Denis "Jaromil" Roio
Functions
new ([octet]) | Create a new Big number. |
modrand (modulo) | Generate a random Big number whose ceiling is defined by the modulo to another number. |
random () | Generate a random Big number whose ceiling is the order of the curve. |
modmul (coefficient, modulo) | Multiply a BIG number by another BIG while ceiling the operation to a modulo to avoid excessive results. |
Functions
- new ([octet])
-
Create a new Big number. If an argument is present, import it as OCTET and initialise it with its value.
(octet)
Parameters:
- octet value (optional)
Returns:
-
a new Big number
- modrand (modulo)
-
Generate a random Big number whose ceiling is defined by the modulo to another number. (modulo)
Parameters:
- modulo another BIG number, usually ECP.order
Returns:
-
a new Big number
- random ()
-
Generate a random Big number whose ceiling is the order of the curve. ()
Returns:
-
a new Big number
- modmul (coefficient, modulo)
-
Multiply a BIG number by another BIG while ceiling the operation to a modulo to avoid excessive results. This operation is to be preferred to the simple overladed operator '' in most cases where such a multiplication takes place. It may replace '' in the future as a simplification.
(coefficient, modulo)
Parameters:
- coefficient another BIG number
- modulo usually ECP.order
Returns:
-
a new Big number