Module gridiron::fp_256[][src]

Expand description

Why 31 bit?

31 bit numbers allow us to work well in WASM as well as other 32 bit architectures with greater speed than 32 bits (or 64 bits). This is because when you use only 31 bits you don’t have to deal with carries that go outside the limb size as often. This is explained very well by Thomas in his writeup in BearSSL https://www.bearssl.org/bigint.html.

We technically could go to something larger (like 62) if we only wanted to be fast on 64 bit machines, but this is the lowest common denominator, so we decided to start here. In the future it would be nice to allow the internal representation to be chosen based on compile-time flags instead.

Structs

Allows iteration over the bit representation of $classname starting with the least significant bit first

This is the Montgomery form of the $classname. This is typically used for its fast implementation of Multiplication as the conversion to Montgomery form + multiplication is as fast as normal multiplication + reduction.

Constants