How it works ?

TopSecret and image files

TopSecret uses pseudo-random spacial algorithm to store the secret data. The storage coordinates path is defined by the Master Password. Using multiple master passwords on the same file could then lead to secret corrupting if the pathes have pixels in common.

TopSecret and PDF files

PDF files can store theorically unlimited amount of secret data. No spacial storage here, only map storage (key/value arrays). This allows using multiple Master Passwords on a single PDF cover. 

Storing data into PNG images

PNG (Portable Network Graphics) is an image file format that uses a lossless compression algorithm.

Lossless means that each pixels remain exactely the same between two saves.

Red, Green, Blue and even Alpha components can store up to 8 bits.

Using the Least Significant Bit (LSB) of each pixel's component to store 1 bit at a time of the secret will not visually affect the image.

Even 2 or 3 bits can be used according to the image complexity. The higher the bits are changed, the most the visual impact will be.

This example shows a 267x200 pixels 24-bits RGBA image. It can hold up to 213,600 bytes. The original file size is 130kB.

Image resultFile sizeSecret size (%)
154kB52,788 bytes (24%)
177kB117,232 bytes (54%)
189kB157,460 bytes (73%)
201kB190,904 bytes (84%)
209kB207,292 bytes (97%)

As we can see above, filling up to 25% of the total capacity would not affect so much the final aspect.

The visual distortion is a linear function of the used/total capacity ratio.

Storing data into JPEG images

Joint Photographic Experts Group is an image file format that is multilayered to optimize the compression of a photo-style image.

Compression algorithm (simplified) :

  • Layer 1 : Translate RGB to YCrCb - lossless
  • Layer 2 : Turn 8*8 pixels blocs into discrete cosine transform (DCT) coefs - lossy
  • Layer 3 : Huffman compression - lossless

The layer 2 is the heart of the solution : lossy part - that means you could not retrieve exactly the same pixels after a loading/editing/saving/loading operation sequence even in unmodified areas.

To securely hide some data, Top-Secret modifies the least significant bits of each non-null DCT coef, instead of the pixel's components.

This example shows a 267x200 pixels 24-bits RGB image. It can hold up to 5904 bytes through the DCT coefficient bits. This is far less that the PNG equivalent (213,600 bytes).

The original file size is 29kB.

Image resultFile sizeSecret size (%)
30kB1,692 bytes (28%)
30kB2,952 bytes (50%)
 
31kB4,212 bytes (71%)
31kB4,736 bytes (80%)
32kB5,344 bytes (90%)
33kB5,648 bytes (95%)
 
34kB5,892 bytes (99%)

Through JPEG can not embed so much data, it can be filled up to 50% until the visual impact becomes notable.

The visual distortion is an exponential function of the used/total capacity ratio.

PDF documents

A Portable Document Format is a hierarchical structure with several maps.

A map is a key-value array. This is a good place to insert a special key and an encrypted part of a secret. The special key is a fixed header with the second hash (i.e. the hash of the hash) of the Master Password followed by an index. The index is the equivalent to the images' spatial path to be followed to rebuild the encrypted secret sequence.

This is quiet simple, fast and allows unlimited data to be hidden.

TopSecret can store multiple secret data using different Master Passwords - whereas images cannot, with a risk of overwriting some other secret due to pseudo-random spacial storage.