@@ -33,6 +33,80 @@ TrueEntropy harvests entropy from real-world sources and converts it into crypto
3333
3434---
3535
36+ ## Operation Modes
37+
38+ TrueEntropy supports two operation modes, selectable via ` configure(mode=...) ` :
39+
40+ ### Mode Comparison
41+
42+ | Aspect | DIRECT Mode | HYBRID Mode |
43+ | --------| -------------| -------------|
44+ | ** Speed** | ~ 60K ops/sec | ~ 5M ops/sec |
45+ | ** Source** | Direct pool extraction | PRNG seeded by pool |
46+ | ** Security** | Maximum (true random) | High (periodic reseed) |
47+ | ** Use Case** | Crypto keys, wallets | Simulations, games |
48+
49+ ### DIRECT Mode (Default)
50+
51+ Every call extracts fresh entropy directly from the pool:
52+
53+ ```
54+ trueentropy.random() ──► EntropyTap.random() ──► pool.extract(8) ──► float
55+ ```
56+
57+ ```
58+ ┌────────────────────────────────────────────────────────────────────┐
59+ │ DIRECT MODE │
60+ ├────────────────────────────────────────────────────────────────────┤
61+ │ │
62+ │ random() ───► EntropyTap ───► Pool ───► 8 bytes ───► float │
63+ │ │ │
64+ │ ▲ │
65+ │ Harvesters │
66+ │ │
67+ └────────────────────────────────────────────────────────────────────┘
68+ ```
69+
70+ ### HYBRID Mode
71+
72+ Uses a fast PRNG (Mersenne Twister) that re-seeds from the pool periodically:
73+
74+ ```
75+ trueentropy.random() ──► HybridTap.random() ──► PRNG.random() ──► float
76+ │
77+ └──► (every N seconds) ──► pool.extract(32) ──► PRNG.seed()
78+ ```
79+
80+ ```
81+ ┌────────────────────────────────────────────────────────────────────┐
82+ │ HYBRID MODE │
83+ ├────────────────────────────────────────────────────────────────────┤
84+ │ │
85+ │ random() ───► HybridTap ───► PRNG (Mersenne Twister) ───► float │
86+ │ │ │
87+ │ ▼ (periodic reseed) │
88+ │ Pool ◄────── Harvesters │
89+ │ │ │
90+ │ └──► 32 bytes ──► PRNG.seed() │
91+ │ │
92+ └────────────────────────────────────────────────────────────────────┘
93+ ```
94+
95+ ### Configuration
96+
97+ ``` python
98+ import trueentropy
99+
100+ # DIRECT mode (default) - maximum security
101+ trueentropy.configure(mode = " DIRECT" )
102+
103+ # HYBRID mode - maximum performance
104+ trueentropy.configure(mode = " HYBRID" , hybrid_reseed_interval = 60.0 )
105+
106+ # Combined: Hybrid + Offline (fast, no network)
107+ trueentropy.configure(mode = " HYBRID" , offline_mode = True )
108+ ```
109+
36110## Entropy Sources
37111
38112### 1. Timing Jitter (timing.py)
@@ -300,7 +374,9 @@ Guarantees all N! permutations are equally probable.
300374| Module | Purpose |
301375| --------| ---------|
302376| ` pool.py ` | Accumulates and mixes entropy with SHA-256 |
303- | ` tap.py ` | Extracts entropy and converts to types |
377+ | ` tap.py ` | ` BaseTap ` abstract class + ` EntropyTap ` (DIRECT mode) |
378+ | ` hybrid.py ` | ` HybridTap ` for HYBRID mode (PRNG seeded by pool) |
379+ | ` config.py ` | ` TrueEntropyConfig ` dataclass + ` configure() ` function |
304380| ` collector.py ` | Background thread for automatic collection |
305381| ` health.py ` | Monitors pool health (score 0-100) |
306382| ` harvesters/ ` | Collectors for different entropy sources |
0 commit comments