Skip to content
the practice of concealing messages or information within other nonsecret text or data
C++ Makefile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


the practice of concealing messages or information within other nonsecret text or data

An exemplification of one of the simplest forms of steganography. Recall that a picture is simply a matrix of bytes, so called RGB values, which contain information about the color of each pixel. The spectrum of colors as we see them are therefore mapped to the range [0,255]. The idea is to exploit the lack of precision in the human eye by replacing the least significant bit of each byte in the image with our own data. In doing so, we can encode a byte of our “hidden” information into every 8-bytes of “real” information. See below for an example...

The image on the left is the original image, while the image on the right has Karl Marx's Communist Manifesto embedded in it


Run make to build, which will result in the creation of two executables, namely encode and decode


SFML was used for manipulating pixel data. You can install it here.

To encode file1 into image.png and save the encoding to output.png

./encode image.png file1 output.png
Successfully encoded 92359 bytes into output.jpg

To recover the hidden data from output.jpg

./decode output.png 92359
Successfully extracted 92359 bytes

Note that while this technique is effective against the human eye, it is trivial for a computer to, given an image with hidden data, run through the LSB of every byte in search of some meaningful data. As such, this strategy is extremely vulnerable to statistical counter-attacks, and more sophisticated techniques (e.g. manipulating the coefficients of the DCT) are needed to achieve greater levels of secrecy.

You can’t perform that action at this time.