Skip to main content

Steganography Online Codec SDK For Python

Steganographic Online Codec allows you to hide a password encrypted message within the images & photos using AES encryption algorithm with a 256-bit PBKDF2 derived key.

You can use it for free at:

https://www.pelock.com/products/steganography-online-codec

This SDK provides programming access to the codec and its encoding and decoding functions through a WebAPI interface.

What is steganography & how it works?

Steganography is a term describing the art and science of hiding information by embedding messages within other, seemingly harmless image files.

In this case, the individual bits of the encrypted hidden message are saved as the least significant (LSB) bits in the RGB color components in the pixels of the selected image.

Steganography Online Codec - Hide Message in Image

With our steganographic encoder you will be able to conceal any text message in the image in a secure way and send it without raising any suspicion. It will only be possible to read the message after providing valid, decryption password.

Installation (for Python 3)

The preferred way of Web API SDK installation is via pip (Package Installer for Python).

Run:

pip install steganography-online-codec

or

python3 -m pip install steganography-online-codec

And then add this import to your source code:

from steganography_online_codec import *

Installation package is available at https://pypi.org/project/steganography-online-codec/

Alternative usage

If you don't want to use Python module, you can import directly from the file:

from pelock.steganography_online_codec import *

Packages for other programming languages

The installation packages have been uploaded to repositories for several popular programming languages and their source codes have been published on GitHub:

Repository Language Installation Package GitHub
PyPI repository for Python Python Run pip install steganography-online-codec PyPi Sources
NPM repository for JavaScript and TypeScript JavaScript, TypeScript Run npm i steganography-online-codec or add the following to dependencies section of your package.json file "dependencies": { "steganography-online-codec": "latest" }, NPM Sources

How to hide a secret message within an image file

#!/usr/bin/env python

###############################################################################
#
# Steganography Online Codec WebApi interface usage example.
#
# This example shows how to hide an encrypted secret message in an image file.
#
# Version      : v1.00
# Language     : Python
# Author       : Bartosz Wójcik
# Project      : https://www.pelock.com/products/steganography-online-codec
# Homepage     : https://www.pelock.com
#
###############################################################################

#
# include Steganography Online Codec module
#
from steganography_online_codec import *

#
# create Steganography Online Codec class instance (we are using our activation key)
#
mySteganographyOnlineCodec = SteganographyOnlineCodec("YOUR-WEB-API-KEY")

#
# encode a hidden message (encrypted with your password) within an image file
#
result = mySteganographyOnlineCodec.encode("input_file.jpg", "Secret message", "Pa$$word", "output_file_with_hidden_secret_message.png")

#
# result[] array holds the encoding results as well as other information
#
if result and "error" in result:
	if result["error"] == Errors.SUCCESS:
		print(f'Secret messaged encoded and saved to the output PNG file.')
	else:
		print(f'Error code {result["error"]}')
else:
	print("Something unexpected happen while trying to encode the message.")

More complex example with better explanation and proper error codes checking

#!/usr/bin/env python

###############################################################################
#
# Steganography Online Codec WebApi interface usage example.
#
# In this example, we will see how to hide an encrypted message in an
# image file using our codec.
#
# Version      : v1.00
# Language     : Python
# Author       : Bartosz Wójcik
# Project      : https://www.pelock.com/products/steganography-online-codec
# Homepage     : https://www.pelock.com
#
###############################################################################

#
# include Steganography Online Codec module
#
from steganography_online_codec import *

#
# if you don't want to use Python module, you can import directly from the file
#
#from pelock.steganography_online_codec import *

#
# create Steganography Online Codec class instance (we are using our activation key)
#
mySteganographyOnlineCodec = SteganographyOnlineCodec("YOUR-WEB-API-KEY")

#
# encode a hidden message within the source image file
#

# full version image size limit is set to 10 MB (demo 50 kB max)
# supported image formats are PNG, JPG, GIF, BMP, WBMP, GD2, AVIF, WEBP (mail me for more)
input_file_path = "input_file.webp"

# full version message size is unlimited (demo 16 chars max)
secret_message = "Secret message"

# full version password length is 128 characters max (demo 8 chars max)
password = "Pa$$word"

# where to save encoded image with the secret message
output_file_path = "output_file_with_hidden_secret_message.png"

# encode a hidden message (encrypted with your password) within an image file
result = mySteganographyOnlineCodec.encode(input_file_path, secret_message, password, output_file_path)

#
# result[] array holds the encoding results as well as other information
#
if result and "error" in result:

	print(f'You are running in {"full" if result["license"]["activationStatus"] is True else "demo"} version')

	if result["error"] == Errors.SUCCESS:
		print(f'Secret messaged encoded and saved to {output_file_path}')
	elif result["error"] == Errors.INVALID_INPUT:
		print(f'Invalid input file {input_file_path} or file doesn''t exist')
	elif result["error"] == Errors.MESSAGE_TOO_LONG:
		print(f'Message is too long for the provided image file, use larger file')
	elif result["error"] == Errors.IMAGE_TOO_BIG:
		print(f'Image file is too big, current limit is set to {mySteganographyOnlineCodec.convert_size(result["limits"]["maxFileSize"])}')
	elif result["error"] == Errors.LIMIT_MESSAGE:
		print(f'Message is too long, current limit is set to {result["limits"]["maxMessageLen"]}')
	elif result["error"] == Errors.LIMIT_PASSWORD:
		print(f'Password is too long, current limit is set to {result["limits"]["maxPasswordLen"]}')
	elif result["error"] == Errors.INVALID_PASSWORD:
		print(f'Invalid password')
	else:
		print(f'An unknown error occurred, error code: {result["error"]}')
else:
	print("Something unexpected happen while trying to encode the message.")

How to extract encoded secret message from the image file

#!/usr/bin/env python

###############################################################################
#
# Steganography Online Codec WebApi interface usage example.
#
# In this example, we will see how to extract a previously encrypted & hidden
# secret message from an image file.
#
# Version      : v1.00
# Language     : Python
# Author       : Bartosz Wójcik
# Project      : https://www.pelock.com/products/steganography-online-codec
# Homepage     : https://www.pelock.com
#
###############################################################################

#
# include Steganography Online Codec module
#
from steganography_online_codec import *

#
# if you don't want to use Python module, you can import directly from the file
#
#from pelock.steganography_online_codec import *


#
# create Steganography Online Codec class instance (we are using our activation key)
#
mySteganographyOnlineCodec = SteganographyOnlineCodec("YOUR-WEB-API-KEY")

#
# extract a hidden message from the previously encoded image file
#

# full version image size limit is set to 10 MB (demo 50 kB max)
# supported image format is PNG and only PNG!
input_file_path = "output_file_with_hidden_secret_message.png"

# full version password length is 128 characters max (demo 8 chars max)
password = "Pa$$word"

# extract a hidden message from the image (PNG files only)
result = mySteganographyOnlineCodec.decode(input_file_path, password)

#
# result[] Dict holds the decoding results as well as other information
#
if result and "error" in result:

	print(f'You are running in {"full" if result["license"]["activationStatus"] is True else "demo"} version')

	if result["error"] == Errors.SUCCESS:
		print(f'Secret message is "{result["message"]}"')
	elif result["error"] == Errors.INVALID_INPUT:
		print(f'Invalid input file {input_file_path} or file doesn''t exist')
	elif result["error"] == Errors.IMAGE_TOO_BIG:
		print(f'Image file is too big, current limit is set to {mySteganographyOnlineCodec.convert_size(result["limits"]["maxFileSize"])}')
	elif result["error"] == Errors.LIMIT_MESSAGE:
		print(f'Extracted message is too long, current limit is set to {result["limits"]["maxMessageLen"]}')
	elif result["error"] == Errors.LIMIT_PASSWORD:
		print(f'Password is too long, current limit is set to {result["limits"]["maxPasswordLen"]}')
	elif result["error"] == Errors.INVALID_PASSWORD:
		print(f'Invalid password')
	else:
		print(f'An unknown error occurred, error code: {result["error"]}')
else:
	print("Something unexpected happen while trying to extract the secret message.")

How to check the license key status & current limits

#!/usr/bin/env python

###############################################################################
#
# Steganography Online Codec WebApi interface usage example.
#
# In this example we will verify our activation key status.
#
# Version      : v1.00
# Language     : Python
# Author       : Bartosz Wójcik
# Project      : https://www.pelock.com/products/steganography-online-codec
# Homepage     : https://www.pelock.com
#
###############################################################################

#
# include Steganography Online Codec module
#
from steganography_online_codec import *

#
# if you don't want to use Python module, you can import directly from the file
#
#from pelock.steganography_online_codec import *

#
# create Steganography Online Codec class instance (we are using our activation key)
#
mySteganographyOnlineCodec = SteganographyOnlineCodec("YOUR-WEB-API-KEY")

#
# login to the service
#
result = mySteganographyOnlineCodec.login()

#
# result[] Dict holds the information about the license & current limits
#
if result:

	print(f'You are running in {"full" if result["license"]["activationStatus"] is True else "demo"} version')

	# information about the current license
	if result["license"]["activationStatus"] is True:
		print(f'Registered for - {result["license"]["userName"]}')
		print(f'License type - {"personal" if result["license"]["type"] == 0 else "company"}')
		print(f'Total number of purchased usage credits - {result["license"]["usagesTotal"]}')
		print(f'Remaining number of usage credits - {result["license"]["usagesCount"]}')

	# current limits (different for DEMO and FULL versions)
	print(f'Max. password length - {result["limits"]["maxPasswordLen"]}')
	print(f'Max. message length - {"unlimited" if result["limits"]["maxMessageLen"] == -1 else result["limits"]["maxMessageLen"]}')
	print(f'Max. input image file size - {mySteganographyOnlineCodec.convert_size(result["limits"]["maxFileSize"])}')
else:
	print("Something unexpected happen while trying to login to the service.")

Got questions?

If you are interested in the Steganography Online Codec Web API or have any questions regarding SDK packages, technical or if something is not clear, please contact me. I'll be happy to answer all of your questions.

Bartosz Wójcik

Metadata

Release files for steganography-online-codec 1.0.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 steganography-online-codec 1.0.1
File Size Uploaded Provenance Actions
steganography_online_codec-1.0.1.tar.gz 9.6 kB Without provenance Details for steganography_online_codec-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for steganography-online-codec 1.0.1
File Interpreter ABI Platform Actions
steganography_online_codec-1.0.1-py3-none-any.whl Python 3 none any Details for steganography_online_codec-1.0.1-py3-none-any.whl

Total release size: 16.8 kB

Release files / steganography_online_codec-1.0.1.tar.gz

Download URL steganography_online_codec-1.0.1.tar.gz
Size 9.6 kB
Tags Source
SHA-256 checksum
How to use checksums
702a21cb4cc0ea8f363471ada5c3308731bcf62f1c8353c281c442286a7bbdcf
BLAKE2b-256 checksum
How to use checksums
82bbc6b9cb0f9fb8ba3cb820d75de66b66f6e94802cab51bd0b042fe0eb8b5df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.9.1

Release files / steganography_online_codec-1.0.1-py3-none-any.whl

Download URL steganography_online_codec-1.0.1-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8532dc73936747b5aae4bfcf99881da3bb213795dbcf9186fc94da34aa7107d6
BLAKE2b-256 checksum
How to use checksums
1dda24db1373027a9aa3eabcf8adcd7a7f58be6003ee33cf585447e90d4b6614
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.9.1

Security for steganography-online-codec 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files No provenance

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