Skip to content

Usage

pytorch ^1.12 python ^3.10 license mit Code style: black

Welcome to the StegoBox documentation! 🚀

Steganography /ˌstɛɡəˈnɒɡrəfi/ is the art of concealing a message (secret, payload) within another message (carrier) in such a way that the existence and discovery of the secret message is only available to the sender and intended recipient.

StegoBox is a steganography toolkit that allows you to encode and decode messages using a variety of steganography algorithms. We aim to support both classic steganography algorithms, such as LSB, and state-of-the-art deep learning algorithms, such as SteganoGAN, [TODO] Method here, and FNNS (ICLR 2022), etc.

Get started

StegoBox is currently under active development

The current version of StegoBox is a private work in progress. It is not yet publicly ready for production use.

You will need Python>=3.10. PyTorch>=1.12 and a CUDA enabled environment is required if you want to use the deep learning algorithms efficiently.

[TODO] Installing the library.

Using stegobox as a library

Either import the algorithm from stegobox.codec:

from stegobox.codec import FNNS

stego = FNNS(...)

Or use create_stego to initialize the algorithm:

You won't be able to access auto-completions in your editor if the algorithm is imported this way.

import stegobox

stego = stegobox.create_stego("fnns")(...)

Loading carrier files

A number of carrier files is supported, including various types of images, videos, audios, and even PyTorch weight files, Python .pyc cache files, and PDFs, etc. The module stegobox.io exports all supported file IO methods. For instance, to read an image as a PIL.Image:

from stegobox import io

carrier = io.image.read('/path/to/image')

You can also use your own method for loading carrier files. All stegobox methods are typed, so just make sure you provide the correct type to the encode or decode methods after loading the file.

Using a steganography algorithm

In stegobox, we refer to the secret as payload, and the process of embedding it into the carrier file as encode. (Intuitively, the extraction of the secret message is called decode.)

All stegobox codecs will provide functions encode() and decode(), to allow for the aforementioned functionalities. Some particular methods would have a different name for their function as they might require additional parameters. Refer to the documentation for each individual codec for more details.

Encode

The majority of encode() functions require the following two arguments:

  • carrier: The carrier file, which should be read with one of the stegobox.io methods.
  • payload: The payload message, which usually should be a string.

To encode:

payload = "Super secret message."
encoded_file = stego.encode(carrier, payload)

To further save the encoded file:

io.image.write(encoded_file, "/path/to/stego/image.png")

Decode

The majority of decode() functions only require the encoded carrier file. This file can also be loaded by one of the stegobox.io methods. To decode:

# Assuming the stego file is an image
stego_file = io.image.read("/path/to/stego/image.png")
decoded_payload = stego.decode(stego_file)