NIKX-Tech / NIKX-Tech/numx

rng module: portable PRNG plus entropy hook

Open
#63 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

api-design enhancement pqc
Dominant language
C
Stars
23
Forks
2
PR merge metrics
No merged PRs in 30d

Description

New module, motivated by three separate real problems rather than a hypothetical:

  1. FLAG S-01: numx_sketch_rsvd fails 2 ESP32-S3 tests because rand() seed portability differs across libc implementations (see validation/results/sketch/sketch.md). Not a bug in the algorithm, a portability problem in relying on the platform's rand().
  2. Kyber keygen (the pqc module, #62) needs a CSPRNG. A zero-dependency, no-OS library can't assume /dev/urandom or any platform entropy source exists.
  3. Every module that currently needs randomness (sketch's rsvd, this) rolls its own seeding ad hoc.

Proposed shape: a deterministic core PRNG (PCG or xorshift, small state, no allocation) for reproducible/testable use, plus a caller-supplied entropy callback (numx_rng_seed_from_entropy(fn) or similar) for the cryptographic use case in pqc, where the caller is responsible for supplying real entropy from whatever the platform provides.

Follow-up once this lands: #64 (migrate rsvd to it, close S-01).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the portability failure described in validation/results/sketch/sketch.md and review the proposed numx_rng_seed_from_entropy(fn) API alongside the pqc module in #62. Define the deterministic PRNG core and caller-supplied entropy hook without allocation or OS dependencies; done means the new rng module supports reproducible use and entropy injection for cryptographic callers.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
cryptography, embedded-iot
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.