Skip to content

ozan2003/cloakimg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cloakimg

License: MIT Rust Stars Last Commit Code Size dependency status

Caution

This tool is not audited for security.

It is not recommended for production use.

It is not recommended for use in critical systems.

A command-line tool for hiding and extracting UTF-8 text/binary data into images using RGB LSB steganography with capacity and integrity checks.

Features

  • Encode text/binary data into images: Uses least significant bits of RGB channels.
  • Decode embedded data: Recover hidden messages from compatible images.
  • File or inline input: Provide data directly or from a file.
  • Optional encryption: Store a key/nonce pair in files to encrypt data before embedding.
  • Safe error handling: Clear error messages and non-zero exit codes on failure.

Usage

The tool is driven by subcommands:

  • encode: Embed data into a file.
  • decode: Extract data from a file.
  • cap: Calculate the maximum possible payload size for an image.

Run the following to see the built-in help:

cloakimg --help

Examples

  • Hide a short note:
cloakimg encode data/tp0n3p08.png -t "Meet at 19:30." # output is "a.png"
  • Embed the source code into a image:
cloakimg encode data/tp0n3p08.png --file src/stego/encode.rs"
  • Recover a message to the terminal:
cloakimg decode data/tp0n3p08_secret.png
  • Recover a message to a file:
cloakimg decode data/with_payload.png --output recovered.txt

Encryption (Optional)

Enable encryption for your payload prior to embedding by using a key file. The key file may consist of either 32 raw bytes or a 32-byte ASCII hex string.

A fresh nonce is generated for each encryption and automatically embedded in the payload. The format is: [12-byte nonce][N-byte ciphertext][16-byte tag]. During decryption, the nonce is extracted automatically.

# Encrypt before embedding
cloakimg encode data/tp0n3p08.png -o data/tp0n3p08_secret.png \
  --key-file secrets/image.key \
  -t "Meet at 19:30."

# Provide the same key to decrypt (nonce is extracted automatically)
cloakimg decode data/tp0n3p08_secret.png \
  --key-file secrets/image.key

Mismatched keys will prevent successful decryption. Each encryption automatically uses a unique nonce.

Limitations

  • Supported image formats: PNG, BMP, TIFF, PPM.
  • Available capacity depends on image dimensions and encoding details; very long messages may not fit into small images.

Packages

No packages published

Languages