The problem
Digital images leak structure. Neighboring pixels are highly correlated, so a weak permutation still looks like a photograph. A useful cipher has to destroy both position and value — then recover both exactly when the key is known.
Undergraduate thesis · Chaos theory · Cryptography
A grayscale cipher that binds the key to the image itself: pixels are shuffled by a logistic orbit, then drowned in a double diffusion driven by a linear feedback shift register.
01 — Overview
Digital images leak structure. Neighboring pixels are highly correlated, so a weak permutation still looks like a photograph. A useful cipher has to destroy both position and value — then recover both exactly when the key is known.
The logistic map xn+1 = r xn(1 − xn) at r = 3.99 supplies a chaotic sequence for shuffling. An 8-bit LFSR with taps [7, 5, 4, 3] supplies a bit stream for mixing. Forward and backward diffusion spread a single pixel change across the whole canvas.
The logistic seed is not a static password. It is offset by the image’s mean intensity, so even a one-pixel edit yields a different orbit — and a different permutation. Decryption stores that sum in catatan_kunci.txt.
02 — Pipeline
Encryption is a one-way walk through six stages. Decryption is the same walk in reverse: undo diffusion, unshuffle, reshape.
Read grayscale. Rasterize the matrix into a 1-D pixel vector of length N = H × W.
x0 = (0.123456789 + ΣI / 255N) mod 1. A zero seed is replaced by 0.5.
Iterate the logistic map for N steps. Sort the orbit to obtain a permutation.
Reorder pixels by that permutation. Spatial neighbors become strangers.
Clock an 8-bit register from seed 0b10101010. Scale bits to 0 or 255.
Forward: ci = (si + ki + ⌊255 xi⌋ + ci−1) mod 256. Then a backward carry pass.
03 — Logistic map
In the chaotic regime the map is deterministic but unpredictable without the exact seed. That orbit becomes the shuffle key: we argsort the sequence and move every pixel to a new index.
04 — Linear feedback
Each tick XORs taps 7, 5, 4, and 3, shifts the register right, and feeds the result into the MSB. The LSB after the shift is the keystream bit — then multiplied by 255 so it can mix with pixel intensities.
feedback = b7 ⊕ b5 ⊕ b4 ⊕ b3
05 — Confusion & diffusion
06 — Live laboratory
Same mathematics as the Python thesis code, on a full 256×256 field (65,536 pixels). Drop a photo — it is center-cropped and converted to grayscale — or generate a subject.
Waiting for a source image.
Security notice
This cipher was built for research and demonstration. It is not a production cryptosystem. The LFSR is short, the logistic map is floating-point, and the dynamic key must be stored to invert the permutation. Treat it as a study of chaos-based confusion and diffusion — not as a replacement for AES.
View the original algorithm on GitHub