Quick and easy C# steganography library for encrypting and decrypting strings into image files when building .NET Framework apps.
Made from scratch for the purpose of building the Leonardo Desktop App.
dotnet add package Stegodon
Right click on your project solution and go to your NuGet package manager.
Encrypt() takes 2 arguments. First is Bitmap
and the seocond one is a string
.
// Example
string imagePath = "path/to/your/img.jpg"
string secretMsg = "p@55w0rd"
Bitmap encryptedImage = Stegodon.Encrypt(new Bitmap(imagePath), secretMsg);
Output is a prompt to save your image as a .png
file.
Decrypt() takes a Bitmap argument. In the below example we assume that the user wants to decrypt a string from an image.
// Example
string imagePath = openFileDialog.FileName;
Bitmap chosenImg = new Bitmap(imagePath);
Stegodon.Decrypt(chosenImg);
Output is the decrypted string.
Txt2Bin(string text)
Converts a string into a binary format suitable for embedding into an image.
Bin2Txt(string binaryMessage)
Converts a binary string back into readable text.
The solution I made isn’t anything new and broad, but it is concentrated in allowing users to use steganography easily to encrypt and decrypt strings into and from image files. The encryption process first normalizes the image making sure all pixel data is even to minimize error whilst injecting new bits into the file and to avoid breaking pixels. Then we just embed string binary data into the least significant bits of each RGB color channel. The decryption is simply extracting back information from the LSB of each channel.