### Install tox Source: https://github.com/computationalcore/cryptosteganography/blob/main/CONTRIBUTING.md Install the tox testing tool. This is typically a one-time setup step. ```bash python3 -m pip install tox ``` -------------------------------- ### Install Dependencies Source: https://github.com/computationalcore/cryptosteganography/blob/main/CONTRIBUTING.md After activating the virtual environment, use this command to install all the necessary project dependencies listed in requirements.txt. ```bash pip install -r requirements.txt ``` -------------------------------- ### Project structure example Source: https://github.com/computationalcore/cryptosteganography/blob/main/CONTRIBUTING.md Illustrates a traditional Python project layout with source code and tests in separate directories at the root. ```plaintext root_folder ├── cryptosteganography │ ├── __init__.py │ ├── cli.py │ └── lib.py ├── tests │ ├── __init__.py │ └── test_generate.py ├── tox.ini └── setup.py ``` -------------------------------- ### Check Installed Version (CLI) Source: https://context7.com/computationalcore/cryptosteganography/llms.txt Display the installed version of the cryptosteganography tool. ```bash cryptosteganography --version # 0.8.4 ``` -------------------------------- ### Install pip3 (Ubuntu) Source: https://github.com/computationalcore/cryptosteganography/blob/main/README.rst Installs pip3 on Ubuntu systems, a prerequisite for installing Python packages. ```bash $ sudo apt-get install python3-pip ``` -------------------------------- ### Install cryptosteganography Package Source: https://github.com/computationalcore/cryptosteganography/blob/main/README.rst Installs the cryptosteganography Python package using pip3. ```bash pip3 install cryptosteganography ``` -------------------------------- ### Save File to Image Source: https://github.com/computationalcore/cryptosteganography/blob/main/README.rst Example of saving a binary file (e.g., a .pem key) into an image. You will be prompted for a password. ```bash $ cryptosteganography save -i input_image_name.jpg -f duck_logo.pem -o output_file.png Enter the key password: Output image output_file.png saved with success ``` -------------------------------- ### Sync Virtual Environment Dependencies Source: https://github.com/computationalcore/cryptosteganography/blob/main/CONTRIBUTING.md After updating or generating requirements files, use this command to install or uninstall packages to match the specified requirements, ensuring the virtual environment is in sync. ```bash (venv)$ pip-sync requirements.txt dev-requirements.txt ``` -------------------------------- ### Install Python 3 (MacOS) Source: https://github.com/computationalcore/cryptosteganography/blob/main/README.rst Installs Python 3 on MacOS using the Homebrew package manager. Ensure your PATH is updated. ```bash ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" ``` ```bash export PATH=/usr/local/bin:/usr/local/sbin:$PATH ``` ```bash brew install python3 ``` -------------------------------- ### Retrieve File from Image Source: https://github.com/computationalcore/cryptosteganography/blob/main/README.rst Example of retrieving a hidden binary file from an image. You will be prompted for the password used during saving. ```bash $ cryptosteganography retrieve -i output.png -o decrypted_file Enter the key password: decrypted_file saved with success ``` -------------------------------- ### Save Message to Image Source: https://github.com/computationalcore/cryptosteganography/blob/main/README.rst Example of saving a text message into an image file. You will be prompted for a password. ```bash $ cryptosteganography save -i 4824157.png -m "My secret message..." -o output.png Enter the key password: Output image output.png saved with success ``` -------------------------------- ### Retrieve Message from Image Source: https://github.com/computationalcore/cryptosteganography/blob/main/README.rst Example of retrieving a hidden text message from an image file. You will be prompted for the password used during saving. ```bash $ cryptosteganography retrieve -i output.png Enter the key password: My secret message... ``` -------------------------------- ### View Save Help (CLI) Source: https://context7.com/computationalcore/cryptosteganography/llms.txt Display the full help information for the `save` subcommand. ```bash cryptosteganography save -h ``` -------------------------------- ### Show Main Help Source: https://github.com/computationalcore/cryptosteganography/blob/main/docs/index.md Displays the main help message for the cryptosteganography script, outlining available sub-commands and general usage. ```bash $ cryptosteganography -h usage: cryptosteganography [-h] {save,retrieve} ... A python steganography script that save/retrieve a text/file (AES 256 encrypted) inside an image. positional arguments: {save,retrieve} sub-command help save save help retrieve retrieve help optional arguments: -h, --help show this help message and exit ``` -------------------------------- ### View Retrieve Help (CLI) Source: https://context7.com/computationalcore/cryptosteganography/llms.txt Display the full help information for the `retrieve` subcommand. ```bash cryptosteganography retrieve -h ``` -------------------------------- ### Package Source Distribution Source: https://github.com/computationalcore/cryptosteganography/blob/main/CONTRIBUTING.md Run this command to create a source distribution of the project, typically used for packaging and redistribution. It generates a .tar.gz file in the dist/ directory. ```bash python3 setup.py sdist ``` -------------------------------- ### Command Line Help Source: https://github.com/computationalcore/cryptosteganography/blob/main/README.rst Displays the main help message for the cryptosteganography command-line tool, showing available sub-commands. ```bash $ cryptosteganography -h ``` -------------------------------- ### Show Retrieve Command Help Source: https://github.com/computationalcore/cryptosteganography/blob/main/README.rst Use this command to display the help message for the retrieve subcommand, showing available options. ```bash $ cryptosteganography retrieve -h ``` -------------------------------- ### Create and Activate Virtual Environment (Windows CMD) Source: https://github.com/computationalcore/cryptosteganography/blob/main/CONTRIBUTING.md Use these commands to create a virtual environment named 'venv' and activate it on Windows using the Command Prompt. Note the different activation script path. ```bash py -m venv venv virtualenv\Scripts\activate.bat ``` -------------------------------- ### Create and Activate Virtual Environment (Linux/macOS) Source: https://github.com/computationalcore/cryptosteganography/blob/main/CONTRIBUTING.md Use this command to create a virtual environment named 'venv' and activate it on Linux or macOS systems. This isolates project dependencies. ```bash python3 -m venv venv source venv/bin/activate ``` -------------------------------- ### Command Line Save Sub-command Help Source: https://github.com/computationalcore/cryptosteganography/blob/main/README.rst Displays the help message for the 'save' sub-command, detailing its arguments for hiding data in an image. ```bash $ cryptosteganography save -h ``` -------------------------------- ### Show Retrieve Sub-command Help Source: https://github.com/computationalcore/cryptosteganography/blob/main/docs/index.md Displays the help message for the 'retrieve' sub-command, detailing the arguments required to extract hidden data from an image. ```bash $ cryptosteganography retrieve -h usage: cryptosteganography retrieve [-h] -i INPUT_IMAGE_FILE [-o RETRIEVED_FILE] optional arguments: -h, --help show this help message and exit -i INPUT_IMAGE_FILE, --input INPUT_IMAGE_FILE Input image file. -o RETRIEVED_FILE, --output RETRIEVED_FILE Output for the binary secret file (Text or any binary file). ``` -------------------------------- ### Initialize CryptoSteganography with a Password Key Source: https://context7.com/computationalcore/cryptosteganography/llms.txt Instantiate the CryptoSteganography class with a password. This password is used to derive a 256-bit AES key for encryption. Ensure the same password is used for both hiding and retrieving data. ```python from cryptosteganography import CryptoSteganography # Initialize with a strong password — the same password must be used to retrieve crypto = CryptoSteganography('my-super-secret-password-2024!') # Unicode passwords are fully supported crypto_unicode = CryptoSteganography('你好,世界') ``` -------------------------------- ### Save Binary File into Image (CLI) Source: https://context7.com/computationalcore/cryptosteganography/llms.txt Use the `save` command with the `-f` flag to embed a binary file (like PDF, audio, or certificates) into a carrier image. The output will be a PNG file. ```bash cryptosteganography save -i carrier.jpg -f secret_document.pdf -o output_doc.png ``` ```bash # Enter the key password: •••••••• # Output image output_doc.png saved with success ``` -------------------------------- ### Compile and Update Dependencies Source: https://github.com/computationalcore/cryptosteganography/blob/main/CONTRIBUTING.md These commands use pip-tools to compile the input requirements files (.in) into locked dependency files (.txt). This ensures reproducible builds. ```bash (venv)$ pip install pip-tools (venv)$ pip-compile --output-file requirements.txt requirements.in (venv)$ pip-compile --output-file dev-requirements.txt dev-requirements.in ``` -------------------------------- ### Retrieve Binary File (CLI) Source: https://context7.com/computationalcore/cryptosteganography/llms.txt Use the `retrieve` command with the `-i` flag to extract a hidden binary file from a stego image and save it to disk using the `-o` flag. ```bash cryptosteganography retrieve -i output_doc.png -o recovered_document.pdf # Enter the key password: •••••••• # recovered_document.pdf saved with success ``` -------------------------------- ### Run tox tests Source: https://github.com/computationalcore/cryptosteganography/blob/main/CONTRIBUTING.md Execute all defined test environments using tox. To run a specific environment, append its name (e.g., -e pep8). ```bash tox #To run a specific environment, specify it like: -e pep8 ``` -------------------------------- ### Hide and Retrieve Binary File Source: https://github.com/computationalcore/cryptosteganography/blob/main/docs/index.md Illustrates how to hide a binary file (e.g., an MP3) within an image and then retrieve it. This method is suitable for any type of file, provided its size is smaller than the input image. ```APIDOC ## Hide and Retrieve Binary File ### Description This example demonstrates hiding a binary file's content within an image and subsequently retrieving it. The process involves reading the binary file into memory, hiding it using `CryptoSteganography`, and then retrieving the data to save it as a new file. This is useful for securely transferring small binary files embedded in images. ### Method ```python from cryptosteganography import CryptoSteganography # Read the binary file content message = None with open('sample.mp3', 'rb') as f: message = f.read() # Initialize CryptoSteganography with a password key crypto_steganography = CryptoSteganography('My secret password key') # Hide the binary message inside the input image and save to an output image file crypto_steganography.hide('input_image_name.jpg', 'output_image_file.png', message) # To demonstrate retrieval, instantiate a new object with the same password key # This is not strictly necessary if the previous object is still in scope. crypto_steganography = CryptoSteganography('My secret password key') # Retrieve the binary data from the image decrypted_bin = crypto_steganography.retrieve('output_image_file.png') # Save the retrieved binary data to a new file with open('decrypted_sample.mp3', 'wb') as f: f.write(decrypted_bin) ``` ### Parameters - `password` (string): The secret key for encryption/decryption. - `input_image_path` (string): Path to the source image. - `output_image_path` (string): Path to save the image with hidden data. - `message` (bytes): The binary content of the file to hide. ### Response - `retrieve()` returns the hidden binary data as bytes. ``` -------------------------------- ### Upgrade Pip in Virtual Environment Source: https://github.com/computationalcore/cryptosteganography/blob/main/CONTRIBUTING.md Once a virtual environment is activated, it's recommended to upgrade pip to the latest version to ensure compatibility and access to the newest features. ```bash (venv)$ pip install --upgrade pip ``` -------------------------------- ### CryptoSteganography(key) Source: https://context7.com/computationalcore/cryptosteganography/llms.txt Initializes the CryptoSteganography class with a password key. This key is used to derive an AES-256 encryption key. ```APIDOC ## CryptoSteganography(key) — Initialize with a password key Creates a `CryptoSteganography` instance that derives a 32-byte AES key from the provided string password using SHA-256. All subsequent hide/retrieve operations on this instance use this derived key. ### Parameters #### Path Parameters - **key** (string) - Required - The password string to derive the encryption key from. ### Request Example ```python from cryptosteganography import CryptoSteganography # Initialize with a strong password — the same password must be used to retrieve crypto = CryptoSteganography('my-super-secret-password-2024!') # Unicode passwords are fully supported crypto_unicode = CryptoSteganography('你好,世界') ``` ``` -------------------------------- ### CryptoSteganography.retrieve(input_image_file) Source: https://context7.com/computationalcore/cryptosteganography/llms.txt Extracts the LSB-encoded payload from an image, base64-decodes it, recovers the IV, and decrypts the ciphertext using AES-256-CBC. Returns the original data or None. ```APIDOC ## CryptoSteganography.retrieve(input_image_file) — Decrypt and extract hidden data from an image Extracts the LSB-encoded payload from the given image, base64-decodes it, recovers the embedded IV, and decrypts the ciphertext with AES-256-CBC using the instance's derived key. Returns the original string if the data is valid UTF-8, raw `bytes` if the data is binary, or `None` if no valid hidden data exists or the password is wrong. ### Parameters #### Path Parameters - **input_image_file** (string) - Required - The path to the image file containing the hidden data. ### Response - **(string or bytes or None)** - The original hidden data (string or bytes), or None if no data is found or the password is incorrect. ### Request Example ```python from cryptosteganography import CryptoSteganography # --- Retrieve a hidden text message --- crypto = CryptoSteganography('s3cr3t-k3y!') secret = crypto.retrieve('output_stego.png') if secret is not None: print(secret) # "Meet me at midnight." else: print('No secret found or wrong password.') # --- Retrieve hidden binary data and save to file --- crypto = CryptoSteganography('s3cr3t-k3y!') audio_data = crypto.retrieve('output_stego_audio.png') if isinstance(audio_data, bytes): with open('recovered.mp3', 'wb') as f: f.write(audio_data) print('Binary file recovered successfully.') # --- Wrong password returns None (does not raise) --- wrong_crypto = CryptoSteganography('wrong-password') result = wrong_crypto.retrieve('output_stego.png') assert result is None # Graceful failure — no exception raised # --- Image with no hidden data also returns None --- empty_result = crypto.retrieve('plain_photo.jpg') assert empty_result is None ``` ``` -------------------------------- ### Handle Incorrect Password or No Hidden Data Source: https://context7.com/computationalcore/cryptosteganography/llms.txt Demonstrates that attempting to retrieve data with the wrong password or from an image without hidden data gracefully returns None, without raising an exception. This behavior applies to both text and binary data retrieval. ```python from cryptosteganography import CryptoSteganography # --- Wrong password returns None (does not raise) --- wrong_crypto = CryptoSteganography('wrong-password') result = wrong_crypto.retrieve('output_stego.png') assert result is None # Graceful failure — no exception raised # --- Image with no hidden data also returns None --- crypto = CryptoSteganography('s3cr3t-k3y!') empty_result = crypto.retrieve('plain_photo.jpg') assert empty_result is None ``` -------------------------------- ### Recover Binary Payload with Python Library Source: https://context7.com/computationalcore/cryptosteganography/llms.txt Use the `retrieve` method to extract binary data from a stego image. The returned bytes can then be written to a new file. ```python # --- RECOVER the binary payload --- recovered_bytes = crypto_retrieve.retrieve('carrier_zip.png') with open('recovered.zip', 'wb') as f: f.write(recovered_bytes) print(f'Binary file recovered: {os.path.getsize("recovered.zip")} bytes') ``` -------------------------------- ### Save Text Message into Image (CLI) Source: https://context7.com/computationalcore/cryptosteganography/llms.txt Use the `save` command with the `-m` flag to embed a text message into a carrier image. The output will be a PNG file. ```bash cryptosteganography save -i carrier.jpg -m "My secret message" -o output.png ``` ```bash # Enter the key password: •••••••• # Output image output.png saved with success ``` -------------------------------- ### Hide Text Message with Python Library Source: https://context7.com/computationalcore/cryptosteganography/llms.txt Instantiate `CryptoSteganography` with a password and use the `hide` method to embed text into an image. Requires the input image to exist. ```python from cryptosteganography import CryptoSteganography import os PASSWORD = 'ultra-secure-passphrase-42!' INPUT_IMAGE = 'photo.jpg' STEGO_IMAGE = 'photo_stego.png' # --- HIDE a text message --- crypto = CryptoSteganography(PASSWORD) crypto.hide(INPUT_IMAGE, STEGO_IMAGE, 'Top secret: launch at dawn.') print(f'Stego image saved: {STEGO_IMAGE}') ``` -------------------------------- ### Retrieve Text Message with Python Library Source: https://context7.com/computationalcore/cryptosteganography/llms.txt Instantiate `CryptoSteganography` with the correct password and use the `retrieve` method to extract hidden text from a stego image. Returns the message string. ```python crypto_retrieve = CryptoSteganography(PASSWORD) message = crypto_retrieve.retrieve(STEGO_IMAGE) print(f'Recovered: {message}') # "Top secret: launch at dawn." ``` -------------------------------- ### Handle Incorrect Password Retrieval (Python) Source: https://context7.com/computationalcore/cryptosteganography/llms.txt When `retrieve` is called with an incorrect password, it gracefully returns `None` instead of raising an exception. This simplifies error handling in production code. ```python # --- RETRIEVE with wrong password (graceful None) --- wrong = CryptoSteganography('incorrect') assert wrong.retrieve(STEGO_IMAGE) is None print('Wrong password correctly returned None.') ``` -------------------------------- ### CryptoSteganography.hide(input_filename, output_filename, data) Source: https://context7.com/computationalcore/cryptosteganography/llms.txt Encrypts data using AES-256-CBC, base64-encodes it, and embeds it into a carrier image using LSB steganography. Saves the output as a PNG file. ```APIDOC ## CryptoSteganography.hide(input_filename, output_filename, data) — Encrypt and hide data inside an image Encrypts `data` (a string or bytes) using AES-256-CBC with a random IV, base64-encodes the result, and embeds it into the carrier image using LSB steganography. Saves the result as a PNG file at `output_filename`. The input image can be any PIL-supported format (JPEG, PNG, BMP, etc.), but the output is always PNG. ### Parameters #### Path Parameters - **input_filename** (string) - Required - The path to the carrier image file. - **output_filename** (string) - Required - The path where the output PNG image with hidden data will be saved. - **data** (string or bytes) - Required - The secret message or binary data to hide. ### Request Example ```python from cryptosteganography import CryptoSteganography crypto = CryptoSteganography('s3cr3t-k3y!') # --- Hide a text message --- crypto.hide( 'carrier_photo.jpg', # Input image (any PIL-supported format) 'output_stego.png', # Output image (always saved as PNG) 'Meet me at midnight.' # Secret text message ) # => output_stego.png is created; visually identical to carrier_photo.jpg # --- Hide a binary file (e.g., an audio file) --- # NOTE: The binary payload must be smaller than the carrier image capacity with open('confidential.mp3', 'rb') as f: audio_bytes = f.read() crypto.hide( 'carrier_photo.jpg', 'output_stego_audio.png', audio_bytes # Raw bytes — any binary format is accepted ) # => output_stego_audio.png now invisibly contains the encrypted audio data ``` ``` -------------------------------- ### Hide Binary Payload with Python Library Source: https://context7.com/computationalcore/cryptosteganography/llms.txt Read binary data from a file and use the `hide` method to embed it into a carrier image. The `payload` argument should be bytes. ```python # --- HIDE a binary payload --- payload_path = 'secret.zip' with open(payload_path, 'rb') as f: payload = f.read() crypto.hide(INPUT_IMAGE, 'carrier_zip.png', payload) ``` -------------------------------- ### Handle Wrong Password (CLI) Source: https://context7.com/computationalcore/cryptosteganography/llms.txt When the wrong password is provided during retrieval, the command returns a non-zero exit code and prints an error message. No data is recovered. ```bash cryptosteganography retrieve -i output.png # Enter the key password: •••••••• (wrong password) # No valid data found ``` -------------------------------- ### Hide Binary File in Image Source: https://github.com/computationalcore/cryptosteganography/blob/main/README.rst Hides a binary file (e.g., MP3) within an image file. The concealed file must be smaller than the input image. Reads the file content and then hides it. ```python from cryptosteganography import CryptoSteganography message = None with open('sample.mp3', "rb") as f: message = f.read() crypto_steganography = CryptoSteganography('My secret password key') # Save the encrypted file inside the image crypto_steganography.hide('input_image_name.jpg', 'output_image_file.png', message) # Retrieve the file (the previous crypto_steganography instance could be used but I instantiate a brand new object # with the same password key just to demonstrate that it can be used to decrypt) crypto_steganography = CryptoSteganography('My secret password key') decrypted_bin = crypto_steganography.retrieve('output_image_file.png') # Save the data to a new file with open('decrypted_sample.mp3', 'wb') as f: f.write(secret_bin) ``` -------------------------------- ### Hide and Retrieve String Message Source: https://github.com/computationalcore/cryptosteganography/blob/main/docs/index.md Demonstrates how to hide a string message within an image and then retrieve it. A secret password key is used for encryption and decryption. ```APIDOC ## Hide and Retrieve String Message ### Description This example shows how to use the `CryptoSteganography` class to hide a string message inside an image file and then retrieve it. The message is encrypted using AES-256 with a provided password key. ### Method ```python from cryptosteganography import CryptoSteganography # Initialize with a secret password key crypto_steganography = CryptoSteganography('My secret password key') # Hide the message inside the input image and save to an output image file # The output image will contain the hidden message. crypto_steganography.hide('input_image_name.jpg', 'output_image_file.png', 'My secret message') # Retrieve the hidden message from the output image secret = crypto_steganography.retrieve('output_image_file.png') # Print the retrieved message print(secret) # Expected output: My secret message ``` ### Parameters - `password` (string): The secret key used for AES-256 encryption and decryption. - `input_image_path` (string): Path to the image file where the message will be hidden. - `output_image_path` (string): Path to save the new image file containing the hidden message. - `message` (string): The secret message to hide. ### Response - `retrieve()` returns the hidden message as a string. ``` -------------------------------- ### Automatic PNG Extension Appending (CLI) Source: https://context7.com/computationalcore/cryptosteganography/llms.txt If the output filename provided to the `save` command does not have a `.png` extension, it will be automatically appended. ```bash cryptosteganography save -i carrier.jpg -m "hidden text" -o result # => Saves as result.png ``` -------------------------------- ### CLI Hide Secret via Command Line Source: https://context7.com/computationalcore/cryptosteganography/llms.txt Encrypts and embeds a secret message or file into a carrier image using the command-line interface. The password is prompted securely. The output is always a PNG file, with the extension automatically appended if missing. ```bash cryptosteg save -i carrier_photo.jpg -o output_stego.png -m "My secret message." cryptosteg save -i carrier_photo.jpg -o output_audio.png -f confidential.mp3 ``` -------------------------------- ### Retrieve Text Message (CLI) Source: https://context7.com/computationalcore/cryptosteganography/llms.txt Use the `retrieve` command with the `-i` flag to extract a hidden text message from a stego image. The message will be printed to standard output. ```bash cryptosteganography retrieve -i output.png # Enter the key password: •••••••• # My secret message ``` -------------------------------- ### Hide Binary File Data Inside an Image Source: https://context7.com/computationalcore/cryptosteganography/llms.txt Encrypts binary data (e.g., audio, documents) using AES-256-CBC, base64-encodes it, and embeds it into a carrier image using LSB steganography. The output is saved as a PNG file. The binary payload must be smaller than the carrier image's capacity. ```python from cryptosteganography import CryptoSteganography crypto = CryptoSteganography('s3cr3t-k3y!') # --- Hide a binary file (e.g., an audio file) --- # NOTE: The binary payload must be smaller than the carrier image capacity with open('confidential.mp3', 'rb') as f: audio_bytes = f.read() crypto.hide( 'carrier_photo.jpg', 'output_stego_audio.png', audio_bytes # Raw bytes — any binary format is accepted ) # => output_stego_audio.png now invisibly contains the encrypted audio data ``` -------------------------------- ### Retrieve Hidden Binary Data from an Image Source: https://context7.com/computationalcore/cryptosteganography/llms.txt Extracts LSB-encoded data from an image, base64-decodes it, recovers the IV, and decrypts the ciphertext using AES-256-CBC. Returns the original bytes if the data is binary, or None if no data is found or the password is incorrect. No exception is raised for incorrect passwords. ```python from cryptosteganography import CryptoSteganography crypto = CryptoSteganography('s3cr3t-k3y!') # --- Retrieve hidden binary data and save to file --- audio_data = crypto.retrieve('output_stego_audio.png') if isinstance(audio_data, bytes): with open('recovered.mp3', 'wb') as f: f.write(audio_data) print('Binary file recovered successfully.') ``` -------------------------------- ### Retrieve Hidden Text Data from an Image Source: https://context7.com/computationalcore/cryptosteganography/llms.txt Extracts LSB-encoded data from an image, base64-decodes it, recovers the IV, and decrypts the ciphertext using AES-256-CBC. Returns the original string if it's valid UTF-8, or None if no data is found or the password is incorrect. No exception is raised for incorrect passwords. ```python from cryptosteganography import CryptoSteganography # --- Retrieve a hidden text message --- crypto = CryptoSteganography('s3cr3t-k3y!') secret = crypto.retrieve('output_stego.png') if secret is not None: print(secret) # "Meet me at midnight." else: print('No secret found or wrong password.') ``` -------------------------------- ### Hide Text Data Inside an Image Source: https://context7.com/computationalcore/cryptosteganography/llms.txt Encrypts a text message using AES-256-CBC, base64-encodes it, and embeds it into a carrier image using LSB steganography. The output is saved as a PNG file. The carrier image can be in any PIL-supported format. ```python from cryptosteganography import CryptoSteganography crypto = CryptoSteganography('s3cr3t-k3y!') # --- Hide a text message --- crypto.hide( 'carrier_photo.jpg', # Input image (any PIL-supported format) 'output_stego.png', # Output image (always saved as PNG) 'Meet me at midnight.' # Secret text message ) # => output_stego.png is created; visually identical to carrier_photo.jpg ``` -------------------------------- ### Hide Text Message in Image Source: https://github.com/computationalcore/cryptosteganography/blob/main/README.rst Hides a secret text message within an image file using AES-256 encryption. Requires an input image, output file name, and the secret message. ```python from cryptosteganography import CryptoSteganography crypto_steganography = CryptoSteganography('My secret password key') # Save the encrypted file inside the image crypto_steganography.hide('input_image_name.jpg', 'output_image_file.png', 'My secret message') secret = crypto_steganography.retrieve('output_image_file.png') print(secret) # My secret message ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.