Skip to main content
https://travis-ci.org/computationalcore/cryptosteganography.svg?branch=master https://codecov.io/github/computationalcore/cryptosteganography/coverage.svg?branch=master https://img.shields.io/lgtm/grade/python/g/computationalcore/cryptosteganography.svg?logo=lgtm&logoWidth=18 https://api.codeclimate.com/v1/badges/1f8d04f4badc720d0eda/maintainability Latest Version Development Status Python Versions

A python steganography module to store messages or files protected with AES-256 encryption inside an image.

Steganography is the art of concealing information within different types of media objects such as images or audio files, in such a way that no one, apart from the sender and intended recipient, suspects the existence of the message. By default steganography is a type of security through obscurity.

Additionally this module also enhance the security of the steganography through data encryption. The data concealed is encrypted using AES 256 encryption, a popular algorithm used in symmetric key cryptography.

Prerequisites

Python 3+

pip3

(Most Linux systems comes with python 3 installed by default).

Dependencies Installation (Ubuntu)

$ sudo apt-get install python3-pip

Dependencies Installation (MacOS)

To install Python3 I recommend use Homebrew package manager

The script will explain what changes it will make and prompt you before the installation begins.

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Edit your ~/.profile to include (if it is not already there)

export PATH=/usr/local/bin:/usr/local/sbin:$PATH

To install Python 3:

$ brew install python3

Installation

To install the package just run

$ pip3 install cryptosteganography

Usage

Use as a library in a python program

Store a message string inside an image

from cryptosteganography import CryptoSteganography

crypto_steganography = CryptoSteganography('My secret password key')

# Save the encrypted file inside the image
crypto_steganography.hide('input_image_name.jpg', 'output_image_file.png', 'My secret message')

secret = crypto_steganography.retrieve('output_image_file.png')

print(secret)
# My secret message

Store a binary file inside an image

Note: This only works if the concealed file size is smaller than the input image

from cryptosteganography import CryptoSteganography

message = None
with open('sample.mp3', "rb") as f:
    message = f.read()

crypto_steganography = CryptoSteganography('My secret password key')

# Save the encrypted file inside the image
crypto_steganography.hide('input_image_name.jpg', 'output_image_file.png', message)

# Retrieve the file ( the previous crypto_steganography instance could be used but I instantiate a brand new object
# with the same password key just to demonstrate that can it can be used to decrypt)
crypto_steganography = CryptoSteganography('My secret password key')
decrypted_bin = crypto_steganography.retrieve('output_image_file.png')

# Save the data to a new file
with open('decrypted_sample.mp3', 'wb') as f:
    f.write(secret_bin)

Use as a python program

Check help at command line prompt to learn how to use it.

$ cryptosteganography -h
usage: cryptosteganography [-h] {save,retrieve} ...

A python steganography script that save/retrieve a text/file (AES 256
encrypted) inside an image.

positional arguments:
  {save,retrieve}  sub-command help
    save           save help
    retrieve       retrieve help

optional arguments:
  -h, --help       show this help message and exit

Save sub command help

$ cryptosteganography save -h
usage: cryptosteganography save [-h] -i INPUT_IMAGE_FILE
                              (-m MESSAGE | -f MESSAGE_FILE) -o
                              OUTPUT_IMAGE_FILE

optional arguments:
  -h, --help            show this help message and exit
  -i INPUT_IMAGE_FILE, --input INPUT_IMAGE_FILE
                        Input image file.
  -m MESSAGE, --message MESSAGE
                        Your secret message to hide (non binary).
  -f MESSAGE_FILE, --file MESSAGE_FILE
                        Your secret to hide (Text or any binary file).
  -o OUTPUT_IMAGE_FILE, --output OUTPUT_IMAGE_FILE
                        Output image containing the secret.

Retrieve sub command help

$ cryptosteganography retrieve -h
usage: cryptosteganography retrieve [-h] -i INPUT_IMAGE_FILE [-o RETRIEVED_FILE]

optional arguments:
  -h, --help            show this help message and exit
  -i INPUT_IMAGE_FILE, --input INPUT_IMAGE_FILE
                        Input image file.
  -o RETRIEVED_FILE, --output RETRIEVED_FILE
                        Output for the binary secret file (Text or any binary
                        file).

Save message example

$ cryptosteganography save -i 4824157.png -m "My secret message..." -o output.png
Enter the key password:
Confirm the key password:
Output image output.png saved with success

Retrieve message example

$ cryptosteganography retrieve -i output.png
Enter the key password:
My secret message...

Save file example

$ cryptosteganography save -i input_image_name.jpg -f duck_logo.pem -o output_file.png
Enter the key password:
Confirm the key password:
Output image output_file.png saved with success

Retrieve file example

$ cryptosteganography retrieve -i output.png -o decrypted_file
Enter the key password:
decrypted_file saved with success

License

This project is licensed under the MIT License - see the LICENSE file for details

Authors

Vin Busquet file for details

Limitations

  • Only works with python 3

  • It does not work if the conceived file is greater than original input file

  • I did not tested with all conceived file types. Feel free to report any bug you find

Contributing

For details, check out CONTRIBUTING.md.

Changelog

For details, check out CHANGELOG.md.

Acknowledgments

Metadata

Release files for cryptosteganography 0.8.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cryptosteganography 0.8.1
File Size Uploaded
cryptosteganography-0.8.1.tar.gz 9.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cryptosteganography 0.8.1
File Interpreter ABI Platform
cryptosteganography-0.8.1-py3-none-any.whl Python 3 none any Details

Total release size: 17.9 kB

Release files / cryptosteganography-0.8.1.tar.gz

Download URL cryptosteganography-0.8.1.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
872f8161136503ac7dc5fd89c51758afe90a973aeecc5040af4b8bb3aad7355c
BLAKE2b-256 checksum
How to use checksums
fe4a3615ac5d484b64e8984147d69e68d5b62a427b4793666f9525d46bcfafd1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.5

Release files / cryptosteganography-0.8.1-py3-none-any.whl

Download URL cryptosteganography-0.8.1-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7c3eed144d3d19197625b382dd243cb0107836718a6cc6e041271ee8bbd8af9b
BLAKE2b-256 checksum
How to use checksums
a6e00768fccbbba1a9535c693b7e6cb3ddf1e57373b8c42a11c9d58dc756c4c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.5

Release history Release notifications | RSS feed

0.8.4

2 release files

0.8.3

1 release file

0.8.2

2 release files

This release

0.8.1 This release

2 release files

0.2.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page