@vapourisation/steganography
TypeScript icon, indicating that this package has built-in type declarations

0.0.5-beta.6 • Public • Published

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 a steganography.node file. This is then referenced in the index.js file and exported for use in another Node project.
  • You can also just use npm run build to get the built steganography.node module.

Dependencies

  • There are some external dependencies. libjpeg (libjpeg-turbo is recommended) and libpng. png++ and jpeg++ are dependencies but are included in the deps 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.

/@vapourisation/steganography/

    Package Sidebar

    Install

    npm i @vapourisation/steganography

    Weekly Downloads

    1

    Version

    0.0.5-beta.6

    License

    ISC

    Unpacked Size

    1.01 MB

    Total Files

    66

    Last publish

    Collaborators

    • vapourisation