The Image Hash Spoof Tool is a Python-based utility that modifies an image file to produce a cryptographic hash (e.g., SHA-512) with a specified hexadecimal prefix. The tool ensures that the visual appearance of the image remains unchanged to the human eye while altering the file to match the desired hash prefix.
- Modifies an image imperceptibly using least significant bit (LSB) adjustments.
- Supports SHA-512 hashing for secure and robust hash matching.
- Outputs an altered image that retains the original's visual quality.
- Python 3.7+
- Required Python libraries:
Pillow
hashlib
- Clone the repository or download the script:
git clone https://github.com/LeroySBN/hash_spoofer.git cd hash_spoofer
- Install the required Python libraries:
pip install Pillow
The tool is executed via the command line with the following syntax:
./spoof <hex_prefix> <input_image> <output_image>
<hex_prefix>
: The desired starting hexadecimal prefix of the hash (e.g.,0x24
).<input_image>
: The path to the original image file.<output_image>
: The path to save the modified image.
To modify original.jpg
such that its SHA-512 hash starts with 0x24
, and save the result as altered.jpg
:
./spoof 0x24 original.jpg altered.jpg
Upon completion, the script outputs:
- The modified image file:
altered.jpg
- The matched hash for verification.
Match found: 2448a6512f[...more bytes...]93de43f4b5b
Modified image saved as altered.jpg
- The script adjusts the least significant bit of random pixels in the image to introduce subtle changes that are imperceptible to human vision.
- After each modification, the script calculates the SHA-512 hash of the image.
- This process repeats until the hash matches the specified prefix.
- Matching a hash with a long prefix may require a significant number of iterations, increasing runtime.
- For better performance, shorter prefixes are recommended.
- The current implementation supports SHA-512 hashing but can be extended to other hash functions.
- Images with strict encoding (e.g., heavily compressed formats) may require additional handling.
This project is licensed under the MIT License.
For questions or contributions, please feel free to open an issue or submit a pull request!