Programming
Steganography using PIL and NumPy
Steganography is the practice of hiding information in other images, audio, text, … You can add hidden messages to pictures, hide a file within another file, … Here we’ll try to hide some information inside an image. Images are essentially two dimensional lists of pixels, which in turn consist of three integer numbers in the range 0-255 that represent values for red, green and blue. The difference between a pixel with value rgb(230, 129, 200) and rgb(229, 129, 201) are virtually imperceptible. So we can leverage this and hide information in that least significant bits of each pixel. To hide a message in an image a function is needed that converts a string to a binary representation and one that embeds that data in the least significant bits of an image. To reveal the message we need to be able to reverse this, so first a function will extract the least significant bits and the final step is to convert them back into a string. Converting Text to Binary and Back To convert text to binary and back I found a function on StackOverflow though it is a little hard to understand. So let’s dissect the encode_text function step by Read more…