Research Preview · Pseudorandom Number Generator

A pseudorandom generator built on the Collatz conjecture.

We construct a cryptographically-motivated PRNG whose security reduces entirely to the conjectured one-wayness of the Collatz function — following the Håstad–Impagliazzo–Levin–Luby framework step by step, with a complete, auditable security proof under that assumption.

⚠ This construction's security is conditional on a conjectured — not proven — hardness assumption. We recommend against production use until further cryptanalysis validates it. See "What This Doesn't Prove" below.
The Construction

From a one-way function candidate to a full PRNG, in four steps.

The 3x+1 problem — repeatedly halving even numbers and applying (3x+1)/2 to odd ones — has an unpredictable trajectory that Vuckovac proposed as a one-way function candidate: any algorithm that inverts it without conditional branching must enumerate an exponential number of execution paths. We take that as our security assumption and build the standard HILL pipeline on top of it.

CBH Assumption
Collatz OWF is one-way
GL Hardcore Bit
Goldreich–Levin, 1989
One-Bit PRG
stretch n → n+1
Iterated PRNG
stretch n → n+k
Each arrow is a security reduction — a distinguisher for the output implies an inverter for the Collatz function.
01

The Collatz one-way function. For a 512-bit input x and 256 iterations, compute the Collatz sequence, record the parity of each step as a path string, split the input and final state into halves, and XOR everything together — producing a 256-bit output where every input bit affects the result.

02

A Goldreich–Levin hardcore bit. Applying the standard GL construction to the Collatz OWF yields a single bit — the inner product of the input with a random string — that's provably as hard to predict as inverting the function itself.

03

A one-bit generator, then iteration. That hardcore bit becomes a PRG with stretch 1. Iterating it — feeding each output state back in as the next seed — extends the stretch to any polynomial length k, following the standard HILL construction.

04

A full security reduction. The main theorem shows that any efficient distinguisher for the generator's output can be converted into an algorithm that inverts the Collatz function — so breaking the PRNG is exactly as hard as breaking the underlying assumption.

The Hardness Assumption

Collatz Branching Hardness (CBH) — the one assumption everything rests on.

Vuckovac's argument shows that any branch-free algorithm implementing the Collatz map must enumerate a table of 2r execution paths — without conditional branching, there's no way to tell which of 2256 composite functions produced a given output. We adopt this as our cryptographic foundation, in the same spirit as the RSA or discrete-log assumptions.

C(x) = x/2  if x is even
C(x) = (3x+1)/2  if x is odd
The modified Collatz map — the odd step and its immediate halving are combined into one operation.

The construction runs this map for r = 256 iterations on a 512-bit input, XORs the input halves with the final-state halves and the recorded parity path, and outputs a 256-bit result — deterministic, fully specified, and dependent on every input bit.

Try It Yourself

The exact construction above, running live in your browser.

This isn't a mockup — it's a JavaScript port of the same C++ reference implementation below: the Collatz OWF, the Goldreich–Levin hardcore bit, and the iterated PRNG, run step for step. Nothing here is sent anywhere; it all runs client-side, in this page.

⚠ Research preview — for exploration only, not production use. See the honest caveat further down this page.
Output will appear here.
Empirical Evaluation

Every test in the NIST SP 800-22 suite, passed — across 80 independent streams.

The construction was instantiated with n = 512, r = 256 iterations, seeded from /dev/urandom, and evaluated with basic statistical tests plus the full NIST Statistical Test Suite (STS 2.1.2) on 80 bitstreams of 106 bits each — 8 × 107 bits total.

Basic Statistical TestValueResult
Monobit (bit frequency)49.9927% onesPASS
Shannon entropy7.999981 bits/bytePASS
Runs test (Z-score)0.3635PASS
Lag-1 autocorrelation−0.006380PASS
NIST SP 800-22 CategoryProportionResult
Frequency & Block Frequency80/80PASS
Cumulative Sums (fwd/back)80/80PASS
Runs & Longest Run79/80PASS
Non-overlapping Templates (148 variants)≥ 76/80PASS
Random Excursions (8 states)≥ 52/53PASS
Serial, Linear Complexity, Universal, Approx. Entropy77–80/80PASS
Total — all 188 sub-testsPASS

Bit balance across all 80 streams: 498,850 to 501,150 ones per 106 bits — a standard deviation of ≈450, consistent with a fair-coin sequence.

Honest About the Gap

Passing every statistical test is necessary. It isn't sufficient.

Statistical test suites confirm the output looks random. They say nothing about whether the Collatz function is actually hard to invert against every adversary — which is what cryptographic security actually requires.

What Vuckovac's argument proves — and what it doesn't

Vuckovac's theorem establishes that branch-free algorithms need exponential time to invert the Collatz iteration. That's a statement about one class of algorithm, not a proof against every possible adversary.

  • It doesn't rule out adversaries that use conditional branching, heuristics, meet-in-the-middle attacks, or algebraic shortcuts.
  • Formal hardness requires the assumption to hold uniformly — on average, over a uniformly random input — which hasn't been separately established.
  • No formal reduction exists yet from inverting this function to a standard, accepted hard problem, like factoring or discrete log.

This is analogous to early RSA: the hardness of factoring was — and still is — an assumption, not a proven fact. The Collatz branching argument offers structural and empirical evidence, which may be enough for exploratory work. It is not yet enough for production cryptography, and we say so plainly rather than overstate it.

Implementation & Parameters
● Open Source

A modular reference implementation, matching each proof step.

Five C++ modules mirror the construction directly: the Collatz OWF, the Goldreich–Levin hardcore bit, the one-bit PRG, the iterated PRNG, and a CLI driver — each using fixed-width 512-bit arithmetic. The live demo above is a faithful JavaScript port of this same reference code.

128-bit security
Input size256 bits
Iterations128
Claimed hardness2^128
192-bit security
Input size384 bits
Iterations192
Claimed hardness2^192
256-bit security
Input size512 bits
Iterations256
Claimed hardness2^256

Hardness figures are under the Collatz Branching Hardness Assumption only — see the honest caveat above.

collatz-prng-reference.zip

All 5 C++ modules, headers, and CMakeLists.txt — builds with CMake + a C++17 compiler.

Download Source →
Get Started

A transparent construction, an open assumption, and a stated gap.

Reference source, the security proof, and the empirical evaluation scripts are available on request.