Invisibilize Data With JavaScript

Invisibilize Data With JavaScript

Hide Data In Plain Sight With Steganography in JS

Cover Photo by Joanna Kosinska on Unsplash

image.png

image.png Photo by Kelly Sikkema on Unsplash

Both images are the same. Or are they?

No, they aren't. The image on the bottom is the original image, while the image on top has been encrypted with a secret message.

Feel free to download the above image and use it in the demo link I have attached below. Try reading the secret text from the file.

CryptoStego Demo link.

Amazing, isn't it. It looks exactly the same to the human eye but contains a secret message! This is possible due to a technique called Steganography.

What is Steganography?

It is the art and science of hiding messages or other secret information in a bunch of carrier information. This is not something new. It has been practised since ancient times. Letters containing text with secret ink is an example of Steganography. We all remember the science experiment where we created invisible ink. That is a form of Steganography too.

In this article, we will speak about modern-day Steganography.


Modern-Day Steganography

Modern-day Steganography can be done with many forms of data. We will discuss the simplest of them in this article. They are,

  • Images
  • Text

There are also other forms of Steganography such as video, audio, etc.

Images

Images can be encoded with secret text. This is done by processing the given message to binary data and hiding all this information in the alpha channel of a given image using the HTML5 canvas element.

There are several libraries available online to implement this function. These two are the popular JavaScript libraries,


Text

There are many algorithms out there that allow you to hide text within the text. Two practices which I found interesting are,

Spammic hides your secret message into spam that looks innocent as you are regularly bombarded with spam emails daily. This encoded message can be decoded to get the secret message.

Stegsnow is free and located in the Ubuntu repository. This encodes secret messages in ASCII text files. Anyone unaware would open the text file and see the innocent text contents in a standard text editor, but "those who know" would run the file with Stegsnow to see a completely different message.

Applications

Printers

Modern-day printers use Steganography techniques to encode printer serial numbers and date and time stamps. These are done by adding tiny, barely visible yellow dots to each page.

Alleged use by intelligence services

There have been allegations that the intelligence services of some countries use tailored steganography program for inserting encrypted text messages within images in order to communicate with "illegal agents" (agents without diplomatic cover) stationed overseas.

Online Challenges

These techniques are used in online algorithmic challenges. Since 2012, Cicada 3301's puzzles have combined Steganography with encryption and other problem-solving approaches. More instigates that use Steganography have been present in alternative reality games over time.


Conclusion

The above-mentioned techniques are not supposed to be encryption methods but rather a fun way of passing secret messages around because anyone who knows how to decode it will eventually get the "secret" message. One advantage of Steganography is that it looks so ordinary. This allows the secret text to be hidden under plain sight.

Anyone is able to decode the hidden message, yet that individual should know about the hidden message in the first place.

Happy Learning!


Resources