Mathematical Pipeline Formulations

This technical reference defines the exact mathematical formulations, cryptographic stretching, pseudorandom spatial mapping, and bitwise transformations driving the STEGNOLINES engine.

1. Dynamic Key & Counter Derivation (PBKDF2-HMAC-SHA256)

To eliminate pre-shared salts while preventing replay attacks, a deterministic 16-byte cryptographic salt $S$ is extracted directly from the cover text:

S = SHA-256(CoverText)[0..15]      (128-bit dynamic salt)

The cryptographic key material is generated by executing 100,000 iterations of PBKDF2:

DerivedBytes = PBKDF2(Password, S, c=100000, dkLen=48, HMAC-SHA256)
Key_AES = DerivedBytes[0..31]          (256-bit AES Key)
Counter_CTR = DerivedBytes[32..47]      (128-bit Initial Counter IV0)

2. Symmetric Cipher Stream (AES-256-CTR)

AES in Counter Mode (CTR) functions as a stream cipher, providing high execution performance with exactly zero padding overhead:

CipherBytes = AES-256-CTR(PayloadBytes, Key_AES, Counter_CTR)
CipherBits = [m_1, m_2, ..., m_K]    where m_j ∈ {0, 1}

3. Cryptographic CSPRNG Seeding & Spatial Placement

The Stego-Key string is derived into a 256-bit cryptographic seed using PBKDF2-HMAC-SHA256 across 100,000 iterations with a domain-specific salt:

Key_{256} = \text{PBKDF2}(\text{StegoKey}, \text{Salt}_{\text{domain}}, c=100000, \text{dkLen}=32, \text{HMAC-SHA256})

An AES-256-CTR CSPRNG combined with Unbiased Rejection Sampling eliminates modulo bias completely and generates deterministic, uniform random indices $P = [p_1, p_2, ..., p_K]$ in the cover text via an $O(K)$ Lazy Fisher-Yates shuffle. (A legacy fallback engine using DJB2 + Mulberry32 is maintained for backward compatibility with previous version messages).

4. Bitwise XOR Masking & Recovery

For each message bit $m_j$ and selected cover bit $c_{p_j}$, the XOR key bit $k_j$ is computed as:

k_j = c_{p_j} ⊕ m_j      (Embedding Phase)

During extraction, the exact message bit is recovered using the same cover bits:

m_j = c_{p_j} ⊕ k_j      (Extraction Phase)

Since $(c_{p_j} \oplus m_j) \oplus c_{p_j} = m_j$, perfect bit-for-bit lossless data reconstruction is mathematically guaranteed.

5. Variation Selector Mapping

VS_CodePoint(B) =
  0xFE00 + B              (if 0 ≤ B ≤ 15, VS1..VS16)
  0xE0100 + B - 16      (if 16 ≤ B ≤ 255, VS17..VS256)