Viewing a single comment thread. View all comments

ChadlyThe3rd t1_iyd6m2m wrote

Super interesting. As a CS student I had a similar “revelation” while cleaning pools for part time work. It wasn’t a novel algorithm by any means but it was a novel discovery for me.

115

chapstickninja OP t1_iyd7tzo wrote

I really believe inspiration is just viewing regular tasks from a different perspective. All it takes is connecting something mundane in a novel way to break through to something new.

92

duderdudeguy t1_iyecjrn wrote

The billion dollar code on Netflix has a perfect example of this

6

TastyOs t1_iye2797 wrote

I’m a CS student too. Curious what algorithm the pool inspired you with

6

ChadlyThe3rd t1_iyed20u wrote

The walls of the pool were tiled and from a distance it looked fine, but up close you could see minor differences in glaze or calcium buildup between the tiles. Some tiles had even been replaced with similar but not identical color tiles. I got to thinking about how they kind of resembled pixels.

From there I started thinking about pixels and how we represent colors as numbers, and how you could store data in a photo in an undetectable to the naked eye way. Depending on the data format we store different things for colors. Sometimes it’s RBGA like with PNG FILES. sometimes RBG.

You can go and set all Alpha numbers down to to the nearest even and you can then store one bit per pixel while losing minimal information in the image. If you were to set every value, R, G, B or A down to an even (just the value there -1 If odd). You lose slightly more data but still invisible to the naked eye and you can store 4 bits per pixel. This is essentially editing the Least Significant Bit (LSB) of each piece of information.

From there we can say that we have 1 byte = 2 pixels. And since each ascii char is a byte we can store 1 character every 2 pixels. You simply encode or decode the photo to retrieve or place the message.

Thus all you need to send messages is a way to send photos without the host/platform downsizing them/compressing them.

This technique is a subset of something called steganography, or hiding messages in plain sight, and is an alternative to cryptography. There is a lot of interesting study in detecting this (as it can be used by terrorists, bad actors, etc) and of course you could always encrypt your message you hide using steganography for added security.

I wrote some fun code to try and make it undetectable. Eg adding noise to the rest of the photo. Trying to evenly space out where I hid my bits in pixels, adding a “key” at a random spot on the file that would tell me what pixel to start and stop at. Very fun way to learn about image formats!

40