<!-- Copyright (c) 2026 defconxt. All rights reserved. -->
<!-- Licensed under AGPL-3.0 — see LICENSE file for details. -->

# API Reference — Detecting Weak Random Number Generation

## ent — Entropy Testing

### Synopsis

```bash
ent [-b] [-c] [-t] <file>
```

### Expected Results for Random Data

| Metric | Expected Value |
|---|---|
| Entropy | > 7.999 bits per byte |
| Chi-square | 50% (acceptable: 10%-90%) |
| Arithmetic mean | 127.5 |
| Serial correlation | ~0.0 |

## System Entropy Sources

| Source | Path | Description |
|---|---|---|
| Kernel pool | `/dev/urandom` | Non-blocking CSPRNG |
| Entropy count | `/proc/sys/kernel/random/entropy_avail` | Bits available |
| Hardware RNG | `/dev/hwrng` | CPU hardware RNG |

## Agent Script

```bash
node agent.js entropy --source /dev/urandom --size 1000000
node agent.js audit ./src --language python
node agent.js tokens --count 1000 --length 32
node agent.js system
```
