A package for hiding data in an image using the Positional LSB algorithm
Project description
Positional LSB
Positional LSB is a steganographic algorithm based on LSB. The algorithm is designed to overcome the lack of ease extracting data when LSB usage is detected. This implementation uses sequential writing of data into pseudo-random pixels of the image.
Content
Requirements
Python 3.10+
The package has 2 required dependencies:
- OpenCV for image manipulation.
- PyCryptodome for encryption.
Installation
pip install positional-lsb
Example
This package implements three options for using the algorithm:
There are differences only in the called class method
encode()
for encode without encryptionencode_with_3des()
for encode with 3DESencode_with_aes()
for encode with AESAnd similarly for
decode
methods
When creating a PositionalLSBImage
class object, as the first argument you need to specify the path to the image that will be used as a container, and the second argument (optional) is the password in the string format.
The use of an algorithm without a password does not reduce the cryptographic strength to the level of the classical LSB, but it makes it easy to extract data if, like you use the package
Encode
You need to create an instance of the PositionalLSBImage class and call the one kind of encode
method and pass the data as the first argument and the name of the output image.
The output image must be with
.png
extension, otherwise nothing will work
from positional_lsb.stego import PositionalLSBImage
# get data in bytes
data = b'Positional LSB is cool!'
lsb_encode = PositionalLSBImage('empty_image.[jpg, png, bpm, ...]', 'Passw0rd')
lsb_encode.encode_with_3des(data, 'image_with_data.png')
Decode
You need to create an instance of the PositionalLSBImage class and call the one kind of decode
method, which returns the data in bytes.
from positional_lsb.stego import PositionalLSBImage
lsb_decode = PositionalLSBImage('image_with_data.png', 'Passw0rd')
data = lsb_decode.decode_with_3des()
# do something with data
# ...
Testing
Tox is used to test this package.
For run tests python 3.10 and 3.11 must be installed
To run tests, install and run tox with the following commands:
# install tox
pip install tox
# run tox
tox
License
This project is licensed under the MIT License. See the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file positional_lsb-0.1.0.tar.gz
.
File metadata
- Download URL: positional_lsb-0.1.0.tar.gz
- Upload date:
- Size: 21.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86bf71bd32118cbdc05a4ac2f1bf9c3f081d4784ae11a58b4193a6b2458ee1e0 |
|
MD5 | 1502cb5d7fa8d4fee226437094a2c5ba |
|
BLAKE2b-256 | e2c10827cbc0b1c6e521ae47300e2d44a3ee9023bf6d7433702fff1b25cd7c82 |
File details
Details for the file positional_lsb-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: positional_lsb-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5fc379c94d8167e992a66046716a144b1be3c36cefa1264ff0bd4397d57430e |
|
MD5 | 9ea2ac08f76d49b01ad161bfaa9b9019 |
|
BLAKE2b-256 | a62a95e9baf576fc02a79eec41bb0e392ac61b99a6207f3a8985f0cf2efbe2cb |