Image methods Image file
DCT coefficients (JSteg)
JSteg, written by Derek Upham in 1993, was the first widely circulated steganography tool for JPEG. It answers a simple difficulty: LSB does not survive JPEG compression, yet nearly every photo is a JPEG. Its answer: hide the message inside the compression.
How does JSteg work?
A JPEG encoder works in four steps:
- the image is cut into blocks of 8 × 8 pixels;
- each block is decomposed into 64 frequencies by the discrete cosine transform (DCT): the first coefficient is the block’s average, the following ones ever finer detail;
- each coefficient is divided then rounded (quantisation): this is where information is lost, and most detail coefficients drop to 0;
- the rounded coefficients are stored losslessly.
JSteg steps in between steps 3 and 4: it replaces the least significant bit of the coefficients with message bits.
Coefficient −7 → bit 1 12 → bit 0 5 → bit 1
Message: 0, 1, 0
Result −8 13 4 Two values are skipped: 0 and 1. Altering them would turn zeros into non-zeros or the reverse, and long runs of zeros are the heart of the compression: the file size would change blatantly.
What does the image look like?
An ordinary JPEG. Changing a coefficient by one unit very slightly alters a texture over an 8 × 8 block: far less than compression has already done. The file keeps roughly the same size.
What are the weaknesses of JSteg?
Strengths
- Works in JPEG, the format of nearly every photo in circulation.
- Invisible to the eye, and file size gives nothing away.
- Good capacity: on the order of one byte per few dozen pixels on a photo, more at high quality.
Weaknesses
- Statistically detectable: in a normal JPEG, coefficients equal to 2 are more frequent than those equal to 3, and so on. JSteg evens out each pair (2 and 3, 4 and 5, −2 and −1…). The chi-square attack by Andreas Westfeld and Andreas Pfitzmann (1999) measures that flattening and even estimates the message length.
- No key: the message is laid out in file order; whoever suspects JSteg reads it.
- Does not survive recompression: re-saving the JPEG, or sending it through a messenger that recompresses, recomputes every coefficient.
- Little room in smooth images: a plain sky has almost nothing but zero coefficients.
How can a message hidden by JSteg be detected?
By plotting the coefficient histogram, which steganalysis tools do. An intact image shows a smooth bell curve around zero; an image processed by JSteg shows steps, two by two. A short message lodged at the start of the file is spotted by running the test on growing portions of the image.
What variants of JSteg exist?
- OutGuess (Niels Provos, 2001) — uses only part of the coefficients and corrects the others to restore the histogram.
- F5 (Andreas Westfeld, 2001) — instead of replacing the bit, decreases the coefficient’s absolute value, scatters the message according to a key and cuts the number of changes with matrix encoding.
- Adaptive methods (J-UNIWARD and successors) — choose the coefficients where a change is least detectable.
- Watermark — aims at the opposite: very little capacity, but resistance to recompression.
In CipherChronicle
The workshop encodes the image as JPEG itself (quality adjustable from 50 to 95) and writes the text into the coefficients; the downloaded file is a .jpg. The capacity shown depends on the image and the quality. The engine carries its own JPEG encoder and a coefficient reader for this; the message layout (32-bit length, then the text) is the workshop’s own, not that of the original JSteg tool. For decryption, drop the file exactly as it is: a screenshot or a re-save wipes everything.