Skip to content

AkshayKanathur/ImageCrypt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

File Encryptor with Metadata

A simple Python tool to encrypt and decrypt files, embedding metadata (original filename and extension) directly in the payload. It also allows secure key generation with automatic clipboard copy for convenience.


Features

  • 🔑 Generate a strong symmetric key (Fernet) and copy it to clipboard.
  • 🔒 Encrypt any file, preserving original filename and extension in metadata.
  • 🔓 Decrypt files, automatically restoring the original name and extension.
  • 🛡️ Prevents overwriting existing files with smart filename handling.

Requirements

  • Python 3.8+
  • Packages:
pip install -r requirements.txt

Usage

Run the script with Python:

python image_crypt.py <action> [options]

Actions

1. Generate Key

Generate a new encryption key and copy it to your clipboard:

python image_crypt.py generate_key

You will see a message that the key is copied. Save it safely! It’s required for decryption.


2. Encrypt a File

Encrypt a file with a key:

python image_crypt.py encrypt -i path/to/input_file -k YOUR_KEY [-o path/to/output_file]
  • -i / --input: Path to the file to encrypt.
  • -k / --key: Your encryption key (copied from generate_key).
  • -o / --output: Optional output filename. Default is <input>_enc.

Example:

python image_crypt.py encrypt -i secret.txt -k gtb7fd7AA5yog9-e93PsgQHsGd_NRVoTh9nIZOLRqew=

3. Decrypt a File

Decrypt a file:

python image_crypt.py decrypt -i path/to/encrypted_file -k YOUR_KEY [-o path/to/output_hint]
  • -i / --input: Path to the encrypted file.
  • -k / --key: Your encryption key.
  • -o / --output: Optional hint for output filename. If omitted, the original filename from metadata is used.

Example:

python image_crypt.py decrypt -i secret.txt_enc -k gtb7fd7AA5yog9-e93PsgQHsGd_NRVoTh9nIZOLRqew=

Notes

  • File metadata is stored inside the encrypted payload, so the original filename and extension are preserved during decryption.
  • If a file with the output name already exists, the script automatically appends (1), (2), etc., to avoid overwriting.
  • The key is sensitive: losing it means you cannot decrypt your files!

License

This project is open-source and free to use. No warranties provided. Use responsibly.

About

A simple Python tool to encrypt and decrypt files, embedding metadata (original filename and extension) directly in the payload. It also allows secure key generation with automatic clipboard copy for convenience.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages