Module RNG

Cryptographically Secure Random Number Generator (RNG)

Each new RNG instance is initialised with a different random seed

Cryptographic security is achieved by hashing the random numbers using this sequence: unguessable seed -> SHA -> PRNG internal state -> SHA -> random numbers.

See this paper for an exstensive description of the process. More recent methods (fortuna etc) are in the works.

Info:

  • Copyright: Dyne.org foundation 2017-2018
  • License: GPLv3
  • Author: Denis "Jaromil" Roio

Functions

octet (int) Create a new OCTET of given lenght filled with random data.
big () Create a new BIG of default ECP curve length filled with random data.
modbig (modulus) Returns a random BIG of default ECP curve length reduced to a modulus (another BIG number) and removing bias.


Functions

octet (int)
Create a new OCTET of given lenght filled with random data. (int)

Parameters:

  • int length of random material in bytes

Usage:

    rng = RNG.new()
    print(rng:octet(32):hex())
big ()
Create a new BIG of default ECP curve length filled with random data. ()

Usage:

    print( RNG.new():big():base64() )
modbig (modulus)
Returns a random BIG of default ECP curve length reduced to a modulus (another BIG number) and removing bias. (modulus)

Parameters:

  • modulus limit the big number to this modulus

Returns:

    a new randomg BIG number
generated by LDoc 1.4.3 Last updated 2018-10-01 18:53:47
]==]