YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
BF-JWT-Policy
Authors: Ahmad Ali Parr, Jessica L. Williams (SNAPKITTYWEST)
RIP Black Hat. Cipher. Quantum Hacker.
Every great system must be destroyed to stand strong.
BF256 (Brainfuck as a cryptographic primitive) was attacked, broken via linear algebra in O(nยณ), and replaced with the correct architecture.
The Architecture
JWT signature: HS256/ES256 (standard, secure)
โ
SPARK-verified Brainfuck VM (bf_vm/)
โ
BF program = authorization POLICY (not a key)
โ
GNATprove: 100% proved, 0 checks failed
Critical distinction:
| Wrong | Right |
|---|---|
| BF as crypto key | BF as policy program |
| BF256 signature | Standard HS256/ES256 signature |
| Secret = initial tape | Secret = HMAC key |
| Broken in O(nยณ) | SPARK-verified correct |
Why BF256 Was Broken
BF + and - operations are affine transformations over โค/256โค. With 2 known (message, signature) pairs:
sigโ = Affine(secret_tape, hash(mโ))
sigโ = Affine(secret_tape, hash(mโ))
Solve for secret_tape via linear algebra. O(nยณ) where n = tape size (typically < 100 cells). Total break.
Ahmad found this himself. Documented it. Built the correct thing.
What's Correct
The Brainfuck VM is Turing-complete, minimal, and formally verifiable. Used as a policy evaluation engine โ not a crypto primitive โ it's:
- Memory safe โ no buffer overflows (SPARK proved)
- Terminating โ step counter decreasing invariant (SPARK proved)
- Deterministic โ same input โ same output (SPARK proved)
- Non-interfering โ secret inputs don't leak to public outputs (SPARK proved)
GNATprove Results
Summary: 100% proved, 0 checks failed, 0 checks unproved
All overflow checks, index checks, termination, and postconditions proved.
Quick Start
# Prove SPARK
cd bf_vm && gnatprove -P bf_vm.gpr --level=2 --report=all
# Build Rust (compiles Ada + FFI)
cd ../bf_jwt_policy && cargo build --release
# Run demo
cargo run --example jwt_policy_demo
Expected:
โ
Authorized! Context: PolicyContext { role: Admin, ... }
โ User denied: Access denied by policy
License
Tri-license โ AGPL-3.0 | BSL 1.1 โ MIT | MIT
Copyright (C) 2026 Ahmad Ali Parr, Jessica L. Williams / SNAPKITTYWEST