Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,31 @@ All notable changes to TrueEntropy will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.2.0] - 2025-12-28

### Added

#### Hybrid Mode
- `configure(mode="HYBRID")` - Switch to high-performance PRNG mode
- `HybridTap` class - PRNG seeded by true entropy from the pool
- `hybrid_reseed_interval` config - Control reseed frequency (default: 60s)
- 83x faster than DIRECT mode (~5M ops/sec vs ~60K ops/sec)

#### Architecture Improvements
- `BaseTap` abstract class - Common interface for tap implementations
- `get_tap()` function - Get current tap instance (EntropyTap or HybridTap)
- Mode switching via `configure(mode="DIRECT"|"HYBRID")`

#### Documentation
- ARCHITECTURE.md updated with Operation Modes section and diagrams
- README.md updated with Hybrid Mode usage and tuning guidelines
- Comprehensive demo script in `examples/demo_comprehensive.py`

### Changed
- `EntropyTap` now inherits from `BaseTap`
- Global `_tap` can now be either `EntropyTap` or `HybridTap`
- `configure()` now supports `mode` and `hybrid_reseed_interval` parameters

## [0.1.1] - 2025-12-27

### Added
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "trueentropy"
version = "0.1.1"
version = "0.2.0"
description = "True randomness from real-world entropy sources - harness chaos from network latency, system jitter, seismic activity, and financial markets"
readme = "README.md"
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion src/trueentropy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
# -----------------------------------------------------------------------------
# Version Information
# -----------------------------------------------------------------------------
__version__ = "0.1.1"
__version__ = "0.2.0"
__author__ = "TrueEntropy Contributors"
__license__ = "MIT"

Expand Down
4 changes: 2 additions & 2 deletions tests/test_harvesters_live.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def test_timing_consistency(self) -> None:
harvester = TimingHarvester(num_samples=32)

results = []
for i in range(5):
for _ in range(5):
result = harvester.collect()
results.append(result.data)
time.sleep(0.01) # Small delay between samples
Expand Down Expand Up @@ -428,7 +428,7 @@ def test_external_source_toggles(self) -> None:


@pytest.fixture(scope="session", autouse=True)
def final_report(request):
def final_report():
"""Print final performance report after all tests complete."""
yield

Expand Down
16 changes: 10 additions & 6 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@
# - End-to-end random number generation
#
# =============================================================================
"""Integration tests for the TrueEntropy library."""

from __future__ import annotations

"""Integration tests for the TrueEntropy library."""

import time


Expand Down Expand Up @@ -148,7 +147,7 @@ def test_feed_affects_pool(self) -> None:
import trueentropy

# Get current health
before = trueentropy.health()
_ = trueentropy.health() # Capture initial state (unused but validates call)

# Feed a lot of data
for _ in range(10):
Expand All @@ -172,13 +171,18 @@ def test_get_pool(self) -> None:
assert isinstance(pool, EntropyPool)

def test_get_tap(self) -> None:
"""get_tap() should return EntropyTap."""
"""get_tap() should return a BaseTap instance (EntropyTap or HybridTap)."""
import trueentropy
from trueentropy.tap import EntropyTap
from trueentropy.config import reset_config
from trueentropy.tap import BaseTap

# Reset to default DIRECT mode to ensure consistent test state
reset_config()
trueentropy.configure(mode="DIRECT")

tap = trueentropy.get_tap()

assert isinstance(tap, EntropyTap)
assert isinstance(tap, BaseTap)


class TestBackgroundCollector:
Expand Down
3 changes: 1 addition & 2 deletions tests/test_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@
# - Edge cases
#
# =============================================================================
"""Tests for the EntropyPool class."""

from __future__ import annotations

"""Tests for the EntropyPool class."""

import threading
import time

Expand Down
3 changes: 1 addition & 2 deletions tests/test_tap.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@
# - Distribution uniformity
#
# =============================================================================
"""Tests for the EntropyTap class."""

from __future__ import annotations

"""Tests for the EntropyTap class."""

import math
from collections import Counter

Expand Down
Loading