Camera TRNG

Turn any webcam into a true random number generator. Cover the lens, run the server, get cryptographic-quality random bytes. Same approach as LavaRnd. Open source, self-hosted.

Live instance

When the QRNG host is online, the API is available at qrng.colinknapp.com. It’s served over a custom reverse-SSH tunnel (like better-argo-tunnels), not Cloudflare Argo—Traefik + SSH + dynamic config. Try it when it’s up:

curl "https://qrng.colinknapp.com/random?bytes=32&hex=true"
curl "https://qrng.colinknapp.com/health"

Get the tool

Repo: git.nixc.us/colin/camera-trng

git clone https://git.nixc.us/colin/camera-trng.git
cd camera-trng
cargo build --release

Cover the camera lens (tape, lens cap, or dark box), then run:

./target/release/camera-qrng

Server runs at http://localhost:8787.

API

EndpointDescription
GET /random?bytes=NGet N random bytes (raw), max 1 MB
GET /random?bytes=N&hex=trueGet N random bytes as hex string
GET /streamContinuous stream of random bytes
GET /healthHealth check

Examples

Local server (or use https://qrng.colinknapp.com when the live instance is up):

# 32 random bytes as hex
curl "http://localhost:8787/random?bytes=32&hex=true"

# 1 KB raw to file
curl "http://localhost:8787/random?bytes=1024" -o random.bin

# Continuous stream
curl -N "http://localhost:8787/stream"

Validation

Output passes NIST SP 800-22–style statistical tests. Run the built-in suite:

./scripts/test-randomness.py --server http://localhost:8787

Full story: Camera TRNG: Webcam-Based True Random Numbers