Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented LFSR generator (with tests and CLI) #27

merged 2 commits into from Jun 4, 2019


Copy link

@AdrienCos AdrienCos commented Jun 4, 2019

This PR introduces a new LFSR-based generator. An LFSR (Linear Feedback Shift Register) will generate a non-repeating pseudo-random sequence of integers, that is bounded between 1 and a power of 2.

The changes add a new generator, that takes a size (pixel index) as an argument, and from here will return a sequence of 2^n-1 (where n is the largest power of 2 below size) integers, seemingly randomly arranged. If a shift is introduced, it prevents an attacker from easily extracting the data, as its start will be hidden in the file.

To use the generator from the CLI:

stegano-lsb-set hide -g LFSR -s $SHIFT -i $INPUT_PATH -o $OUTPUT_PATH -f $SECRET_PATH

The stegano-lsb-set will compute the size of the image, and pass it to the generator. The generator will then compute the value of n and select the optimal parameters it needs to run.

As an example of the usefulness of the generator, I have hidden 520KB of random data in the same picture with two different generators: identity and LFSR. The base image was :


The result of running the steganalysis-parity tool on the image created with the identity generator is:

Notice the very visible vertical stripes caused by the embedding of the payload.

The result of running the same tool on the image created with the LFSR generator is:


While the results are not perfect, I believe that using the LFSR generator provides an extra layer of discretion.

For more information on LFSR: Link

Copy link

@coveralls coveralls commented Jun 4, 2019

Coverage Status

Coverage increased (+0.5%) to 84.389% when pulling 0976929 on AdrienCos:master into bf094c0 on cedricbonhomme:master.


@cedricbonhomme cedricbonhomme merged commit 3780379 into cedricbonhomme:master Jun 4, 2019
2 checks passed
Copy link

@cedricbonhomme cedricbonhomme commented Jun 4, 2019

I didn't knew this. Really interesting generator.
Thanks for these contributions!


@cedricbonhomme cedricbonhomme added this to the Release 0.9.4 milestone Jun 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
3 participants