Implemented LFSR generator (with tests and CLI) #27
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 of2^n-1
(wheren
is the largest power of 2 belowsize
) 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:
The
stegano-lsb-set
will compute the size of the image, and pass it to the generator. The generator will then compute the value ofn
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
andLFSR
. The base image was :The result of running the
steganalysis-parity
tool on the image created with theidentity
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