Skip to content

A hobby project to learn the Rust language: encodes messages in PNG images

Notifications You must be signed in to change notification settings

mattbullen/rust-steganography

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 

Repository files navigation

Steganography using the Rust language

A hobby project to learn the Rust language. This project uses steganography: it encodes a message inside the color/alpha channels of a PNG image's pixels, then later decodes the message to a terminal window.

To encode an image, build and run with:

[width] [height] [decode password] [.txt file with the message] [file name for the PNG]

encode

Be sure to save the final password from the terminal. This is needed to decode the message.

Encoding has two steps. The first step encodes the message characters in their numeric (u8) form inside the color/alpha channels of an intermediate PNG that has been filled with random noise. The noise is there to make it harder to determine which pixels and which channels hold the message information - the only way to know which ones count is to have the password, which sets up the decoding pattern. The intermediate PNG:

raw_encoded_mask

The second step converts the channel values of every pixel in the intermediate image into binary, splits the binary values into individual digits, then applies them to a "mask" file, or an ordinary-looking image. If a binary digit is 0, then one of the channels of the corresponding mask pixel is adjusted (if needed) to hold an even value. If 1, then odd. The visual changes to the image are very slight and usually imperceptible in images with a large variety of bold colors. For example:

encoded_mask

To decode, much the same:

[decode password] [PNG's file name]

decode

About

A hobby project to learn the Rust language: encodes messages in PNG images

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published