| 1 |
bigint: constant-time operations on arbitrarily large integers |
| 2 |
|
| 3 |
Bigint provides constant time operations on big integers. This module is limited |
| 4 |
in scope, therefore the user must exercise caution and read the documentation |
| 5 |
carefully to avoid misuse. Restrictions apply to the compatibility of |
| 6 |
differently-sized big integers, and some functions require an uneven modulo. |
| 7 |
|
| 8 |
A big integer is an array of [[word]] and must be encoded using [[encode]], |
| 9 |
[[encodemod]] or [[encodereduce]]. See [[encodelen]] on how to calculate the |
| 10 |
required size of the array. The big integer will also store its announced bit |
| 11 |
length, i.e. the number of bits that are actually used to store its value; and |
| 12 |
the effective word length, i.e. the number of words that are actually used to |
| 13 |
store the value. The value may be decoded back to its byte format by [[decode]]. |
| 14 |
|
| 15 |
Repeated modular multiplication is supported via montgomery multiplication. See |
| 16 |
[[tomonty]] and [[frommonty]] on how to convert from and back to this format and |
| 17 |
[[montymul]] for the actual multiplication operation. |
| 18 |
|
| 19 |
This is a low-level module which implements cryptographic primitives. Direct |
| 20 |
use of cryptographic primitives is not recommended for non-experts, as |
| 21 |
incorrect use of these primitives can easily lead to the introduction of |
| 22 |
security vulnerabilities. Non-experts are advised to use the high-level |
| 23 |
operations available in the top-level [[crypto::]] module. |
| 24 |
|
| 25 |
Be advised that Hare's cryptography implementations have not been audited. |