@vapourisation/steganography
v0.0.5-beta.6
Published
This project contains all of the base C++ code that makes up the Steganography application. There is a Node web application that utilises the Node library built by this project
Downloads
3
Readme
C++ Steganography
This project contains all the base C++ code that makes up another application. There is a NodeJS web application that utilises the Node library built by this project
What is this repository for?
- Provides methods for steganography encoding and decoding across multiple file formats, as of v0.0.1 this is JPEG, PNG, PSD and PDF.
How do I get set up?
- There is a Dockerfile that, when run, will generate the NodeJS Addon and store it in the
/app/steganography/build/Release
directory as asteganography.node
file. This is then referenced in theindex.js
file and exported for use in another Node project. - You can also just use
npm run build
to get the builtsteganography.node
module.
Dependencies
- There are some external dependencies. libjpeg (libjpeg-turbo is recommended)
and libpng.
png++
andjpeg++
are dependencies but are included in thedeps
directory.
Testing: TODO
Deployment
- To deploy, use as part of a further NodeJS application. This can be achieved using Docker or using the
npm run build
command and install in your Node app.
How to use
These are only examples. You should alter them to better suit your apps needs
When embedding data, this can be directly recovered from files so any data should ideally be encrypted before saving.
From a Node app:
import steganography from 'steganography';
const encoded: string = steganography.encode( input_filepath, text_to_encode, output_filpath );
const decoded: string = steganography.decode( input_filepath );
const phash: string = steganography.getPHash( input_filepath );
For PNGs there are "optional" arguments for bitDepth
and channels
. This is due to how the underlying library handles
PNG files. To make results more consistent and with minimal changes between the input and output, specifying these values
means that both files will be essentially identical. It will make a default guess of 8 bit and 3 channels.
From a Node Docker container using the provided Dockerfile as a builder:
Pull built container
docker pull vapourisation/cpp_stegano
FROM vapourisation/cpp_stegano as builder
WORKDIR /app
USER node
COPY --chown=node:node package*.json ./
RUN npm install
Build locally and use
docker build . -t stegano_cpp
FROM stegano_cpp as builder
WORKDIR /app
USER node
COPY --chown=node:node package*.json ./
RUN npm install
Notes on the PHash
You may ask why there is a PHash method, I even initially removed it before publishing because I didn't think it should be in here but after a little testing I realised that for any actual IRL use case, you're going to want to be able to have a failsafe method for checking the integrity of the processed files. The easiest method for this is some form of hash. This could be done on the whole file, but that's easy enough for anyone to do and means that any change will return a false positive even if the actual image itself is exactly the same (visually). This is where a PHash comes in. It preserves a hash of a thumbnail of the visual representation of an image instead of the entire file data itself, this means that smaller changes won't break the hash unless the visuals are changed, which is arguably more important for images.
Please feel free to fork, raise issues or even offer suggestions for things you'd want from this. It's still very early in development and there are so many file formats I would like to include. Supporting all of them is a little tricky, especially JPEG files due to their annoying (but neat) structure.