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.
Python 3.10+
The package has 2 required dependencies:
- OpenCV for image manipulation.
- PyCryptodome for encryption.
pip install positional-lsb
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
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')
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
# ...
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
This project is licensed under the MIT License. See the LICENSE file for details.