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.

Self-hosted API

The intermittent hosted API has been retired. Clone the project and run it locally so the webcam and generated entropy remain on your own machine.

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

With the local server running:

# 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