PRAHARI प्रहरी

Persistent Random Anchor for Hurwitz-Assured Resilient Integrity

Quantum satellite entropy for post-quantum key generation — 144 seeds, Hurwitz quaternion simulation, Fibonacci-cycle selection.

v3.0.0

The Sentinel at the Mountain Pass

A prahari stands watch at the mountain pass — vigilant, tireless, guarding what flows through. Nepal’s border sentinels carry this title. In yakmesh, PRAHARI guards the entropy pipeline: 144 quantum seeds harvested from IBM Quantum processors, validated through Hurwitz quaternion mathematics, selected by Fibonacci-cycle algorithms. Every cryptographic key in the mesh traces its randomness back to this watchman’s vigil.

PRAHARI & STEADYWATCH

PRAHARI is yakmesh's implementation of the STEADYWATCH project — an open quantum-entropy seed generation system. The underlying code module (yakmesh/security/steadywatch), class names (SteadywatchSeedStore), and seed file formats retain the original STEADYWATCH naming to acknowledge the project's origins. PRAHARI (प्रहरी) is the protocol-layer identity within the yakmesh stack.

✨ STEADYWATCH Quantum Demo — Live Interactive ↗

Overview

PRAHARI manages a constellation of 144 quantum-derived seeds harvested from IBM Quantum processors (ibm_marrakesh). These seeds provide the entropy foundation for ML-KEM-768 key generation in ANNEX, eliminating dependence on classical PRNGs alone.

The system includes a Hurwitz quaternion simulator for test environments, an Entropy Sentinel for quality scoring (NPU-accelerated via TIVRA), and a Ternary-144 addressing scheme built on TRIBHUJ mathematics.

Why 144?

144 = 12² is the 12th Fibonacci number. Its digital root is 9 (the SST singularity), and it divides evenly into three SST family groups of 48 satellites each. This ternary balance is fundamental to the Fibonacci-cycle seed selection algorithm.

SteadywatchSeedStore

The core class that manages the satellite seed constellation:

import { initialize, getHybridSeed, seedStore } from 'yakmesh/security/steadywatch';

// Initialize with real quantum seeds
await initialize({
  seedFile: './data/steadywatch-seeds-p5.json',
  nodeIndex: 42,      // DOKO ceremony assigns this
  prime: 5,           // Hurwitz prime
});

// Or generate test seeds (Hurwitz quaternion simulation)
await initialize({
  generateTest: true,
  prime: 5,
  inferenceEngine: accelInference,  // Optional: wire NPU for Entropy Sentinel
});

Seed File Format

Seeds are stored as JSON with hex-encoded 32-byte values:

{
  "prime": 5,
  "generated": "2026-02-18T...",
  "source": "ibm_marrakesh",
  "seeds": [
    "a3f8e1d4c7b2...  (64 hex chars = 32 bytes)",
    "7b9c0e5a2f1d...  (64 hex chars = 32 bytes)",
    ...  // 144 seeds total
  ]
}

Hurwitz Quaternion Simulation

For development and testing, PRAHARI generates deterministic-but-unpredictable seeds using Hurwitz quaternions parameterized by a prime p:

For each satellite index i (0 to N-1):

  1. Compute rotation angle: θi = 2πi / N
  2. Build quaternion: q = (cosθ, p·sinθ, p²·cosθ, p³·sinθ)
  3. Concatenate all 4 components as Float64 bytes (32 bytes total)
  4. Hash with SHA3-256 to produce the final 32-byte seed

This ensures each seed is unique (SHA3 collision resistance), deterministic (reproducible from prime + index), and statistically indistinguishable from random bytes.

Hybrid Seed Algorithm

getHybridSeed() is the primary integration point — called by ANNEX before every ML-KEM-768 keygen. It produces a 64-byte seed by combining quantum satellite entropy with local CSPRNG:

  1. Fibonacci cycle — Advance the 24-position Fibonacci digital root cycle. The root maps to an SST family (A, B, or C).
  2. Family selection — Select from the indicated family group (48 satellites each). Round-robin within the group prevents overuse of any single seed.
  3. Expand 32 → 64 bytes — Hash the 32-byte satellite seed twice: SHA3(seed || "EXPAND-0") || SHA3(seed || "EXPAND-1")
  4. XOR with CSPRNG — Generate 64 bytes of crypto.randomBytes() and XOR with the expanded satellite seed.
import { getHybridSeed } from 'yakmesh/security/steadywatch';

// Returns 64-byte Uint8Array for ML-KEM-768 keygen
const seed = getHybridSeed();

// Even if the satellite seeds are compromised, the CSPRNG XOR
// ensures the hybrid seed remains at least as strong as local
// entropy. If local CSPRNG is compromised, the quantum entropy
// provides an independent source. Both must fail simultaneously.

Ternary-144 Addressing

Each satellite receives a 6-trit balanced ternary address and belongs to one of three SST families:

SST Family Groups

A
Digital roots 1, 4, 7
48 satellites
NEGATIVE polarity
B
Digital roots 2, 5, 8
48 satellites
POSITIVE polarity
C
Digital roots 3, 6, 9
48 satellites
GOVERNING

6-Trit Addresses

Satellites are addressed using balanced ternary (digits T=-1, 0, 1). The 144th satellite has address 1TT100 in balanced ternary. Lookups work by trit address:

import { getSeedByTritAddress } from 'yakmesh/security/steadywatch';

// Look up seed by its 6-trit address
const result = getSeedByTritAddress('1TT100');  // satellite #144
// { seed: Uint8Array(32), index: 143 }

Fibonacci-Cycle Selection

The Fibonacci digital root sequence repeats every 24 positions (the Pisano period for mod-9). PRAHARI uses this cycle to determine which SST family to draw seeds from:

import { selectByFibonacciCycle } from 'yakmesh/security/steadywatch';

const pick = selectByFibonacciCycle();
// {
//   index: 87,
//   seed: Uint8Array(32),
//   family: 'B',
//   fibPosition: 5,
//   fibRoot: 8,
//   address: '01T110'
// }

// Fibonacci digital root cycle (24 positions):
// 1,1,2,3,5,8,4,3,7,1,8,9,8,8,7,6,4,1,5,6,2,8,1,9
// Maps: roots 1,4,7 → Family A | 2,5,8 → Family B | 3,6,9 → Family C
// Positions 12 and 24: root = 9 → singularity marker (Family C)

Entropy Sentinel

The EntropySentinel scores the quality of seed material before it enters keygen. When an ONNX model is loaded and an NPU/GPU is available (via TIVRA), it uses hardware-accelerated pattern detection. Otherwise, it runs four software statistical tests:

Test Weight Detects
Bit-entropy (per byte) 40% Low information density
Chi-square uniformity 25% Byte frequency bias
Run-length test 15% Repeating byte sequences
Autocorrelation (lag 1) 20% Sequential patterns

The combined score maps to a TRIBHUJ ternary verdict:

POSITIVE
Score ≥ 0.85 — excellent
NEUTRAL
Score ≥ 0.50 — acceptable
NEGATIVE
Score < 0.50 — reject
import { scoreEntropy } from 'yakmesh/security/steadywatch';

const result = await scoreEntropy(seedBytes);
// {
//   score: 0.94,
//   verdict: Trit(POSITIVE),
//   method: 'npu',          // or 'gpu' or 'cpu'
//   details: { bitEntropyPerByte: 7.82, chiSquare: 241.3, ... }
// }

Batch Quality Consensus

After loading all 144 seeds, batchQualityConsensus() aggregates every seed's ternary quality verdict using TritArray.majority():

import { batchQualityConsensus } from 'yakmesh/security/steadywatch';

const consensus = batchQualityConsensus();
// {
//   majority: Trit(POSITIVE),   // overall quality verdict
//   counts: { negative: 2, neutral: 12, positive: 130 },
//   total: 144,
//   balanced: false              // true only if all three are equal
// }

// POSITIVE majority → high-quality quantum entropy
// NEUTRAL majority  → mixed quality (acceptable)
// NEGATIVE majority → WARNING: seeds may be compromised

API Reference

initialize(options)Promise

Load seeds from file or generate test seeds. Optionally wire Entropy Sentinel.

getHybridSeed()Uint8Array(64)

Get a 64-byte hybrid seed for ML-KEM-768 keygen. Primary ANNEX integration point.

scoreEntropy(data)Promise<{ score, verdict, method }>

Score entropy quality of arbitrary byte data. NPU/GPU/CPU.

selectByFibonacciCycle(){ seed, index, family, fibPos }

Select next seed using the 24-position Fibonacci digital root cycle.

getSeedByTritAddress(address){ seed, index } | null

Look up a seed by its 6-trit balanced ternary address.

batchQualityConsensus(){ majority, counts, total }

Aggregate TritArray majority verdict across all loaded seeds.

getStatus()Object

Full status report: seed count, ternary structures, sentinel state, telemetry.

Version History

Version Changes
v3.0.0 Full PRAHARI module: SteadywatchSeedStore, Ternary-144 addressing, Fibonacci-cycle selection, Entropy Sentinel (NPU), batch quality consensus, ANNEX integration.
v2.9.0 Initial seed loading and hybrid seed algorithm.