lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]




On Fri, Jul 10, 2020 at 03:50 Philippe Verdy <verdyp@gmail.com> wrote:
The fact it uses the same fixed-width for all further operations (using a "static" storage from the initialization) limits the usability as a generic-purpose "library": you cannot reuse the library in projects that need different precision. Otherwise they will all use the same precision (256 bits by default) and any change (using different "initializations") will destroy the results with existing instances.
Ideally, the bigints should have a member containing their number of bits (and an indicator that unsigned arithmetic occurs), so that each instance carries it.
As well the library should include primitives to support "rotates"

It depends on what you use the library for. When you implement cryptographic primitives (e.g. elliptic curve signing or elliptic curve Diffie-Hellman) you want the operations to take the same amount of time for all possible inputs to prevent timing attacks, a fixed size big number representation is then more or less required. A typical size would be 256 bits for elliptic curves, or 1024-4096 bits for RSA.


--
-- Gė