1.1.0 • Published 5 months ago

@stegapng/core v1.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

About

Stega PNG allows you to hide arbitrary data into the RGBA colorspace data of images.

Read the API documentation.

Install

To use this core library in your JavaScript or TypeScript project, add it to your project's dependencies using your preferred Node package manager:

npm install @stegapng/core

Colorspace Encoding

Since PNG images use lossless compression, it is possible to store invisible data in the least significant bits of the image's RGB (red, green, and blue) colorspace. Alpha (transparency) channels are ignored since using alpha LSBs would often make it trivial to detect the presence of hidden data.

Where To Embed the Bits?

We can configure exactly where secret bits are embedded in the PNG colorspace data, using the best algorithm that fits our requirements.

By default, a linear congruential generator (LCG) allows us to very efficiently choose target pixel channels pseudorandomly on a "full cycle". This means that each pixel channel is picked at most exactly once. Thus, the available space to store data is maximized without needing to generate large arrays of shuffled indices, keep track of "used" channels, etc.

Data Encoding Scheme

StegaV0

Version 0 embraces the KISS approach. The byte-length of the supplied data is encoded into the first 4 bytes, followed by the data itself.

SegmentLengthDescription
Data Length (L)4 bytesMax 4GB, further limited by the image size
DataL bytesArbitrary user-supplied data

The RGBA colorspace index selection is done via a LCG with parameters derived from the RGBA colorspace array itself.

1.1.0

5 months ago

1.0.0

5 months ago