FnStegoCrypt - Encrypted Data in Images
Main Features
The program offers the following key capabilities:
- Salt Generation and Key Derivation:
- Combines PBKDF2-HMAC with SHA-256 to derive a secure key from a provided password.
- Generates a random salt to enhance key derivation security.
- AES-GCM Encryption:
- Encrypts data using the AES-GCM algorithm, providing both confidentiality and integrated data authentication.
- Data Hiding in Images:
- Uses the least significant bits (LSBs) of pixels to store information without compromising the visible quality of the image.
- Integrity Verification:
- Generates a SHA-256 hash of the original data and embeds it along with the encrypted data, allowing verification of data integrity.
- Support for Multiple Image Formats:
- Supports common formats such as PNG and JPEG, as well as HEIF and HEIC images.
- Batch Processing:
- Allows efficient processing of multiple images in a directory using threads.
Example video of FnStegoCrypt.
Program Structure
ImprovedSteganography
Class
This class is the core of the program, containing methods for all steganography and encryption operations:
-
generate_salt
: Generates a random salt. -
_derive_key
: Derives a secure key from a password using PBKDF2. -
encrypt_data
anddecrypt_data
: Encrypt and decrypt data using AES-GCM. -
hash_data
: Calculates the SHA-256 hash of data to ensure integrity. -
check_image_capacity
: Checks if the image has sufficient capacity to store the data. -
hide_data_in_image
: Embeds encrypted data into the image. -
extract_data_from_image
: Extracts hidden data from the image.
Program Workflow
- Write Mode (Hiding Data):
- The user selects an image file or directory.
- Reads data from a text file and encrypts it.
- Embeds the encrypted data into the image and saves a new version of the image.
- Read Mode (Extracting Data):
- The user provides an image with hidden data and the corresponding password.
- The program extracts and verifies the encrypted data, decrypts it, and returns it to the user.
Key Technologies Used
-
cryptography
Library:- Used for encryption and key derivation.
-
Pillow
Library:- Used for image manipulation.
-
NumPy
:- Provides efficient operations for handling pixel arrays.
-
concurrent.futures
:- Enables parallel processing for batch operations.
Usage Examples
Hiding Data in an Image
- The program prompts for a password, an image path, and a text file path.
- Encrypts the text file content with the provided password.
- Hides the encrypted data in the image and saves the resulting image to an output directory.
Extracting Data from an Image
- The user provides the steganographed image and the password.
- The program verifies the integrity of the data and decrypts it.
- Returns the data to the user, who can choose to view or save it to a file.
Final Considerations
FnStegoCrypt is a powerful tool for applications requiring discretion and security in data transmission. Its use of cutting-edge algorithms like AES-GCM and SHA-256, combined with the ability to work with multiple image formats, makes it ideal for scenarios where data protection is critical.
If you’re interested in contributing to improvements, feel free to explore the code and adapt it to your needs.
Enjoy Reading This Article?
Here are some more articles you might like to read next: