A Go-based tool for encrypting PNG images and hiding them within cover images using steganography techniques.
- Image encryption using XOR cipher
- Steganography support to hide encrypted images in cover images
- Automatic cover image selection from a pool
- Image dimension and size comparison
- Support for PNG format
- Go 1.23.2 or higher
- PNG images for input and cover images
Clone the repository and install dependencies:
git clone https://github.com/nguyenvanduocit/hideimage
cd hideimage
go mod download
.
├── main.go # Main program entry point
├── fns.go # Core encryption/decryption functions
├── assets/
│ └── covers/ # Directory containing cover images
├── input.png # Your input image
└── README.md
key := []byte("YourSecretKey")
err := encryptImage("./input.png", "./encrypted.png", "./cover.png", key)
Decrypting a Hidden Image
key := []byte("YourSecretKey")
err := decryptImage("./encrypted.png", "./decrypted.png", key)
- Place your input image as
input.png
in the project root - Add cover images to
./assets/covers/
- Run the program:
go run .
- Encryption: The tool encrypts the IDAT chunk of PNG images using XOR cipher with the provided key.
- Steganography: The encrypted image is embedded within a cover image using a custom PNG chunk named "stEG".
- Decryption: The tool can extract and decrypt the hidden image using the same key.
The encryption process targets the IDAT chunk of PNG images, which contains the actual image data. The program:
- Locates the IDAT chunk in the PNG file
- Applies XOR encryption with the provided key
- Embeds the encrypted data in a custom chunk within the cover image
- Preserves PNG file structure and integrity
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License. See the LICENSE file for details.