Stegosaurus 1.0.4-beta

This is a prerelease version of Stegosaurus.
dotnet add package Stegosaurus --version 1.0.4-beta
                    
NuGet\Install-Package Stegosaurus -Version 1.0.4-beta
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Stegosaurus" Version="1.0.4-beta" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Stegosaurus" Version="1.0.4-beta" />
                    
Directory.Packages.props
<PackageReference Include="Stegosaurus" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Stegosaurus --version 1.0.4-beta
                    
#r "nuget: Stegosaurus, 1.0.4-beta"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=Stegosaurus&version=1.0.4-beta&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Stegosaurus&version=1.0.4-beta&prerelease
                    
Install as a Cake Tool

Stegosaurus

NuGet

Stegosaurus is a lightweight command-line tool written in C# for securely hiding encrypted messages inside PNG images using LSB (Least Significant Bit) steganography.

It combines strong AES encryption (via PBKDF2-derived keys) with image steganography, making it suitable for sending secret messages disguised inside innocuous-looking image files.

πŸ” Features

  • AES-256 encryption with a password-derived key (PBKDF2 + SHA256)
  • LSB steganography using R, G, B channels (alpha is untouched)
  • PRNG-controlled encoding Pseudo-random number generator (PRNG) for added entropy based on password hash
  • Graceful error handling for corrupt, small, or invalid image files
  • PNG-only for now β€” JPG support would require DCT-based encoding

πŸ“¦ Installation

Stegosaurus is currently in beta because it depends on the beta version of the System.CommandLine package.

dotnet add package Stegosaurus --version 1.0.4-beta

Or manually add it to your .csproj file:

<PackageReference Include="Stegosaurus" Version="1.0.4-beta" />

πŸš€ Usage

Build

dotnet build

Encrypt & Encode

dotnet run -- encrypt -f image.png -m "Secret message here" -o hidden_output.png

Or enter your password at the command line (not recommended, but convenient for scripting/testing):

dotnet run -- encrypt -f image.png -p yourpassword -m "Secret message" -o hidden_output.png

Decode & Decrypt

dotnet run -- decrypt -f hidden_output.png -o secret.txt

πŸ“‚ CLI Flags

Flag Description Required
-f, --file Path to input PNG file βœ…
-m, --message Message to hide (encrypt only) βœ… for encrypt
-p, --password Password for encryption/decryption ❌
-o, --outfile Optional output path for result ❌

⚠️ Notes

  • Only .png files are supported. JPEGs use lossy compression, which discards subtle data like LSBs. To hide data in .jpg files, you'd need to use DCT-based steganography (Discrete Cosine Transform), which this tool does not support.
  • During encoding, the alpha (transparency) channel is ignored to avoid visual artifacts. Only the RGB channels are modified, as changes to alpha values are more likely to cause noticeable distortions.
  • Image must be large enough to store both prefix and encrypted payload, or an error will be thrown and the program will exit gracefully.
  • Corrupt PNGs or tampered files will throw appropriate errors and exit gracefully.
  • If you don’t provide a password via the command line, the program will prompt you securely. This is recommended to avoid exposing the password in terminal history or logs.
  • If you don’t specify an --outfile, one will be auto-generated based on the input file’s name with a timestamp. For decryption/decoding, the output will default to a .txt file.

πŸ§ͺ Testing

Unit tests live in Stegosaurus.Tests/. To run them:

dotnet test

πŸ“¦ Packaging (Coming Soon)

Plans to publish this as a .NET tool (dotnet tool install) are in progress, including CI/CD via GitHub Actions.

πŸ›  Tech Stack

  • C# (.NET 8)
  • ImageSharp for pixel-level image access
  • System.Security.Cryptography for AES + PBKDF2

✍️ Author

Made by Michael Pearce
🌐 michaelpearce.tech β€’ πŸ™ GitHub

πŸ“œ License

MIT License

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.4-beta 444 3/24/2025
1.0.3-beta 435 3/24/2025
1.0.2-beta 434 3/24/2025
1.0.1-beta 436 3/24/2025
1.0.0-beta 438 3/24/2025