Git Product home page Git Product logo

steganos's Introduction

steganos

steganos is a simple program to hide a message in an image or to extract a message from such an image, respectively.

usage

# encryption (CLI):
steganos-cli encrypt --image <IMAGE_FILE> --message <MESSAGE_STRING> --key <KEY_STRING> [--output <OUTPUT_FILE>]
steganos-cli encrypt -i <IMAGE_FILE> -m <MESSAGE_STRING> -k <KEY_STRING> [-o <OUTPUT_FILE>] # shorter version

# decryption (CLI):
steganos-cli decrypt --image <IMAGE_FILE> --key <KEY_STRING> [--end-of-message <EOM_STRING>] [--include-eom]
steganos-cli decrypt -i <IMAGE_FILE> -k <KEY_STRING> [-e <EOM_STRING>] [-E] # shorter version

# GTK app (not recommended)
steganos-gtk

basic concept

The concept is anything but special, it's a simple steganographic task. Each bit of a text message is hidden in one of the RGB values of a pixel in an image. Each pixel has one byte (eight bit) for the red value, one for green and one for blue. Therefore one pixel can store three bits if only one bit is manipulated.

Example: We want to hide the text a in a picture.

[255, 255, 255]	# this is the first pixel, it's white.

# the RGB values as bits look as follows:
1 1 1 1 1 1 1 1  |  1 1 1 1 1 1 1 1  |  1 1 1 1 1 1 1 1

# the first character of our message is 'a', in bits:
0 1 1 0 0 0 0 1

# now we hide the first bit of our first character in the first value of our image, that's the red value of the first pixel
# so that you can't see the difference between the original and the encrypted image, we take the least significant bit
1 1 1 1 1 1 1 1 # this is the original R value
1 1 1 1 1 1 1 0 # the 0 is the first bit from the 'a' we want to hide

# next we can go on with the second bit of the 'a' and hide it inside the green value
1 1 1 1 1 1 1 1 # original G value
1 1 1 1 1 1 1 1 # because the second bit of 'a' is 1 the manipulated bit stays 1

# we proceed according to this scheme and hide all bits of our text 'a'

encryption with a key

steganos further complicates this hiding process by encrypting it with a key. The key consists of another string of text. This text, too, is read as bits. Always when something is hidden in a RGB value of a text the program looks for the next bit of the key. If it's 0 everything is normal and the message bit is hidden in the least significant bit of the current RGB value. But if the current key bit is 1 the program not only manipulates the last bit, it hides two bits. One in the second least significant bit, one in the least significant bit.

Example: The current pixel is again [255, 255, 255], the next pixel is [115, 0, 0], the current message character to hide is again a and the current key character is also a.

# first pixel
[255, 255, 255] -> 	1 1 1 1 1 1 1 1  |  1 1 1 1 1 1 1 1  |  1 1 1 1 1 1 1 1

# message
'a' -> 	0 1 1 0 0 0 0 1

# key
'a' -> 	0 1 1 0 0 0 0 1

# first bit: key is 0, so everything is normal
1 1 1 1 1 1 1 1 # original value (red)
1 1 1 1 1 1 1 0 # the 0 from the 'a' causes the 0 in the last bit

# second bit: key is 1, so the program hides two bits
1 1 1 1 1 1 1 1 # original value (green)
1 1 1 1 1 1 1 1 # the last two 1s come from the 'a', in this case nothing changes

# third bit: key is 1 again
1 1 1 1 1 1 1 1 # original value (blue)
1 1 1 1 1 1 0 0 # the first 0, 1 and 1 from our letter 'a' are already hidden; because the key is 1 the next two bits are hidden

# fourth bit: key is 0 again. The fourth value is hidden in the second pixel. In our example it's a red pixel ([115, 0, 0])
0 1 1 1 0 0 1 1 # the red value of the second pixel (115)
0 1 1 1 0 0 1 0 # the next bit of the 'a' is 0; key is 0, so only one bit to hide

end of message (EOM)

steganos cycles through the given text strings. So if you hide a short message, nevertheless every pixel of the image is manipulated. The output of the decrypt function is therefore as long as the image is big. To prevent outputting a way to big repetitive message when you decrypt, you can specify a EOM (end of message) identifier. This is a pattern to declare the message ended. The default value is *[END]*. Now you can put this identifier inside of your message and steganos will only output what is before this pattern.

examples

There are examples included in this repo. The encrypted files are encrypted using the key This is the key. and the message hidden in the images is This is the message.*[END]*.

steganos's People

Contributors

rabuu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.