Public Private key encryption using image color channels

Binary Overdose

February 2, 2017

This idea poped into my head the other day so I thought I would bosh out a test.

Basically the idea was to take an input image (the private key) and some data. Encode the data into a copy of the image (the public key) by increasing or decreasing the value of each pixels color channel by the ASCII code of each character in the dataset.

In the below example we encode the character H into a single pixel. H is 72 in ASCII.

1

2

3

ASCII 0 7 2 (or H)

RGB (private) 5 50 150 (or mostly blue)

RGB (public) 5 57 152 (H is encrypted into the original pixel)

To decode the pixel we diff the public and private RGB channels and we arrive back at 72 or H.

So without the original image it should be impossible to extract the data from the public key.

In this example I opted for subtlety over volume of data. I am splitting each characters ASCII code across 3 colour channels. That way the maximum increase or decrease in each channel is limited to 9. In effect this makes the new image practically identical to the original.

Please note that I wrote this in the latest flavour of JS without a transpiler so you will need Chrome 55 or similar. Yea I konw.