Implemented from Scratch in C
The SHA-256 Hash CLI Tool is a powerful command-line utility that allows users to compute the SHA-256 hash of a file and store the result in a specified output file. This tool is lightweight, efficient, and ensures that large files exceeding system memory are not processed, preventing crashes.
🛠 Implemented from scratch in C without using any hashing library!
- 🔢 Computes the SHA-256 hash of a given file.
- 🚀 Prevents loading files larger than available system memory.
- 📝 Outputs the hash to a user-specified file.
- ⚡ Simple installation and usage via the command line.
To install the tool, follow these steps:
git clone https://github.com/AS-0167/SHA-256.git
cd SHA-256makesudo make installThis installs the tool as sha-256-hash in /usr/local/bin, making it accessible from anywhere in the terminal. ✅
Once installed, you can run the tool using the following syntax:
sha-256-hash --fpath <file_path> --sha256path <output_path>To compute the SHA-256 hash of file.txt (a sample file given in this repository) and save it to hash.txt, use:
sha-256-hash --fpath file.txt --sha256path hash.txt- ❌ If the file does not exist, the program will display an error message.
- 🚨 If the file size exceeds system memory, the program will terminate safely.
- ⚙️ If incorrect flags are provided, a usage message will be shown.
To remove the tool from your system, run:
sudo make uninstallThis deletes the installed binary from /usr/local/bin/sha-256-hash. 🗑️
If you wish to modify or contribute to this project, follow these steps:
make cleanmake deletemake runThis will execute the tool without installing it system-wide. 🚀
Developed by [AS]. ✨
For any questions or contributions, feel free to reach out or submit a pull request. 🔥