1 minute read

Download the code

Previously I discussed implementing JPEG compression in C#. This was as part of a steganography app for hiding information in JPEG images, which in turn necessitated implementing JPEG compression myself.

F5 is an algorithm for steganography that can be applied to several different image formats, including JPEG. In essence, the F5 algorithm shuffles the quantized DCT coefficients, and then uses matrix encoding to embed your secret message into the shuffled coefficients. If you want to know how it works in detail, you can read the original paper by Andreas Westfield. However, a high level overview of it as follows:

  1. Begin the JPEG compression process but stop after the quantisation phase.
  2. Initialise a cryptographically strong random number generator with a key derived from your password.
  3. Instantiate a pseudo-random permutation of all available quantised DCT coefficients based on the key.
  4. Embed your secret message across the shuffled DCT coefficients through matrix encoding.
  5. Continue with the rest of the JPEG compression process (entropy encoding).

The advantages of this approach are that the total number of modifications to the image are reduced, making it harder to detect the hidden message via statistical analysis, and that the modifications are spread uniformly across the image.

I had intended writing multiple detailed blog posts that explain how the F5 steganography algorithm works, and how to implement it in a C#-based Mac app. But other interests have got in the way, and my enthusiasm for explaining all this has vanished. If you’re interested, you should be able to figure it out from the code.

Updated: