Kingry Graphical Book Cipher Compression Resistant Encrypted Steganography Tool
Hide encrypted messages in images that survive JPEG compression down to quality 60.
Optional password-based encryption using AES-256-CBC with PBKDF2 key derivation.
Messages encoded as character positions in a shared source text file.
DCT watermarking survives JPEG compression down to quality 60.
Reed-Solomon + repetition coding recovers from compression artifacts.
# Clone the repository
git clone https://github.com/akingry/KGBCREST.git
cd KGBCREST
# Install dependencies
pip install pillow numpy scipy reedsolo cryptography
# Run the tool
python server.py
Then open http://localhost:8080 in your browser.
KGBCREST uses multiple layers of protection:
The Discrete Cosine Transform (DCT) converts 8×8 pixel blocks from spatial domain (brightness values) into frequency domain (how quickly brightness changes). This is the same transform JPEG uses.
DC coefficient: Average brightness
Low freq: Smooth gradients
Mid freq: Edges, textures — where we hide data
High freq: Fine detail — discarded by JPEG
JPEG preserves mid-frequencies (edges/structure) while discarding high frequencies. Hiding data here survives compression while remaining visually subtle.
To embed a bit, we quantize the DCT coefficient to encode 0 or 1:
Original coefficient: 127.3
Strength (quantization step): 150
To embed bit = 1:
quantized = round(127.3 / 150) × 150 = 150
modified = 150 + (150 × 0.3) = 195
To embed bit = 0:
quantized = round(127.3 / 150) × 150 = 150
modified = 150 - (150 × 0.3) = 105
Extraction:
coefficient ≥ quantized → bit = 1
coefficient < quantized → bit = 0
For each 8×8 block in the image:
1. Extract block from luminance (Y) channel
2. Apply 2D DCT transform
3. Read coefficient at position (4,3)
4. Modify coefficient using QIM to encode one bit
5. Apply inverse DCT
6. Write modified block back to image
This embeds one bit per 8×8 block. A 1920×1080 image has 32,400 blocks, yielding ~500 usable characters after error correction overhead.
source_text.txt file (the "book" for the cipher)