Shared Parameters
Both encoder and decoder must use the same context and key.
Encode
Encoding character (0/0)
bit 0 of 0
Decode
Processing token: → bit -
bit 0 of 0
Recovered so far:
This demo uses a half-splitting entropy coding scheme built on top of GPT-2's next-token probability distribution.
- The secret message is converted to a bit string (UTF-8 → bits).
- For each secret bit, GPT-2 produces a probability distribution over the entire vocabulary for the next token.
- Tokens are sorted by probability (descending) and split into two halves at the 50% cumulative probability mark.
- Bit
0→ the next token is sampled from the first (higher-probability) half; bit1→ from the second half. - A shared-key PRNG (mulberry32) selects the exact token within the chosen half, so the decoder can reproduce the same random draws.
- The decoder re-runs GPT-2 on the same context, observes which half each cover token fell into, and recovers the bits → original message.
Because both sides share the same model, context, and PRNG seed, the decoder can perfectly reconstruct the hidden bits. The resulting cover text reads like normal GPT-2 output, hiding the secret in plain sight.