- Enhanced /.well-known/mcp.json to extract hostname from request headers (SNI/Host) - Added self-referencing URLs that work with localhost, domains, and reverse proxies - Documented all 5 API endpoints (random, raw, stream, cameras, health) as MCP tools - Added /docs endpoint serving HTML documentation from skill.md - Added /docs/skill.md for raw markdown access - Added /docs/mcp.json as alias to /.well-known/mcp.json - Created skill.md with comprehensive API documentation - Markdown to HTML conversion happens at build time Co-authored-by: Cursor <cursoragent@cursor.com> |
||
|---|---|---|
| man | ||
| scripts | ||
| src | ||
| .cursorignore | ||
| .gitignore | ||
| .woodpecker.yml | ||
| Cargo.lock | ||
| Cargo.toml | ||
| Dockerfile | ||
| LICENSE | ||
| README.md | ||
| RESEARCH.md | ||
| TECHNICAL.md | ||
| openssl-camera-qrng.cnf | ||
| skill.md | ||
README.md
Camera TRNG
TL;DR: Turn any webcam into a true random number generator. Cover the lens, run the server, get random bytes.
What is this?
Your webcam generates electrical noise even when the lens is covered. This noise comes from quantum effects in the sensor. This tool captures that noise and turns it into random numbers - the same approach used by LavaRnd.
Quick Start
1. Install
# Clone and build
git clone https://git.nixc.us/colin/camera-trng.git
cd camera-trng
cargo build --release
Or use Docker (build locally):
docker build -t camera-trng .
2. Cover Your Camera Lens
Use tape, a lens cap, or put the camera in a dark box. The camera should see nothing but blackness.
3. Run
./target/release/camera-qrng
Server starts at http://localhost:8787
4. Get Random Bytes
# Get 32 random bytes (hex)
curl "http://localhost:8787/random?bytes=32&hex=true"
# Get 1KB of raw random data
curl "http://localhost:8787/random?bytes=1024" -o random.bin
# Continuous stream
curl -N "http://localhost:8787/stream"
Is it actually random?
Yes. This tool passes all NIST SP 800-22 statistical tests for randomness:
# Run the built-in test suite
./scripts/test-randomness.py --server http://localhost:8787
The output is cryptographic quality - suitable for generating encryption keys, secure tokens, etc.
API
| Endpoint | Description |
|---|---|
GET /random?bytes=N |
Get N random bytes (max 1024) |
GET /random?bytes=N&hex=true |
Get N random bytes as hex string |
GET /stream |
Continuous stream of random bytes |
GET /health |
Health check |
Troubleshooting
macOS "Camera in use" error:
./scripts/release-camera.sh
./target/release/camera-qrng
Docker (Linux):
docker run -d --device /dev/video0 -p 8787:8787 camera-trng
More Info
- TECHNICAL.md - Full API docs, CI/CD, configuration options
- RESEARCH.md - The science behind camera-based random number generation
License
CC-BY 4.0. See LICENSE.