Skip to content

Supporting pluggable PRNGs #600

@JohnLCaron

Description

@JohnLCaron

We could make it easy to specifiy different PRNGs.

  1. Currently we are using HmacSha256 which creates 32 byte random numbers.
  2. However, Prng.next() gives a Long.
  3. Switching to variable length byte arrays would allow arbitrary cryptographic functions to be used.
  4. The PRNG has to be reproducible in any number of languages/frameworks.
  5. In egk-ec, we store ByteArrays, and HmacSha256 return Uint256, which is always and exactly 32 bytes. It serializes using base 64 encoding of byte arrays. See Base64 class for encoding and decoding.

The "guarenteed soundness" paper doesnt specify what to use, just:

"In practice, the random oracle PRG is instantiated using a cryptographic function such as AES, SHA2, or SHA3, as is standard [24]."

SHA-2 Family Byte Lengths:

SHA-224: 28 bytes
SHA-256: 32 bytes
SHA-384: 48 bytes
SHA-512: 64 bytes

The standard SHA-3 functions and their corresponding output sizes in bytes are:

SHA3-224: produces a 28-byte hash (224 bits).
SHA3-256: produces a 32-byte hash (256 bits).
SHA3-384: produces a 48-byte hash (384 bits).
SHA3-512: produces a 64-byte hash (512 bits).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions