Skip to content
Compres your data using F5 steganography algorithm
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.

F5 Archiver

This repository contains pure C implementation of a steganographic data compression technique based on the F5 algorithm in forms of a library and a command-line tool. With it you can embed any binary data in your JPEG files reducing total data space in your memory without noticeable changes in used images.

You can read a little more on the subject in my medium post.


Simple make used to build everything. On windows you can use Cygwin or MSYS with MinGw to use it properly. If you want to follow a non-Unix way, you'll need to figure it out for yourself.


This project depends on libjpeg (for JPEG decoding and encoding), pcre (POSIX regular expressions support) and tinydir (for a platform-independent filesystem traversal) APIs. Since tinydir provided via the simple header file included in the tree, you only need to make sure you have POSIX regex and libjpeg-compatible APIs linked during the compilation.

If something is not present on your machine, you can build static versions of both libjpeg-turbo's and pcre from an official repositories locally using make libjpeg and make pcre commands. Note that you will need wget, git and cmake to do that.

All necessary headers included in the tree.


You can use F5-based data compression via both command-line tool and C/C++ API.

Command-line tool

You pack and unpack archives from a terminal using f5ar executable in a simple Unix way.

Locate built executable f5ar and use this command to pack data:

./f5ar -p [root library folder] [regex] [file to compress] [archive name]

And this one to unpack it:

./f5ar -u [acrhive file path] [output file]

Make sure that your regex matches only actual jpeg files to prevent errors.


An API provided by the target libf5ar and f5ar.h header file.

Typical packing process looks like this:

  1. Allocate f5archive (on a stack or on a heap) and fill it with zeroes
  2. Initialize it with f5ar_init() call
  3. Call f5ar_add*() functions to add JPEG files and form desired archive
  4. (optional) Use f5ar_analyze() to check if you have enough capacity in your library
  5. Do f5ar_pack() with your data
  6. Save your archive by serializing meta field and order exported with f5ar_export_order()

Typical unpacking process flow:

  1. Allocate f5archive (on a stack or on a heap) and fill it with zeroes
  2. Initialize it with f5ar_init() call
  3. Deserialize meta field and order, import the last one with f5ar_import_order()
  4. Call f5ar_fill*() functions to fill archive with your JPEG files until the returned value is F5AR_OK_COMPLETE
  5. Do f5ar_unpack() and retrieve your data

You can use utility source code as an example if you need more info. Also check out the main header file for more insight on advanced usage.

Command-line-like API

If you are a weirdo and want to use the library the same way you are using the command-line tool, you can use libf5arcmd target and f5ar_cmd.h header file avoiding any confusion using process forking, pipes and other stuff.


Simplified BSD

You can’t perform that action at this time.