Thanks to visit codestin.com
Credit goes to github.com

Skip to content

A lightweight, C-based CLI tool to compute SHA-256 hashes of files from scratch — no libraries used. Includes memory checks, output file writing, and Makefile support.

Notifications You must be signed in to change notification settings

AS-0167/SHA-256

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🔐 SHA-256 Hash CLI Tool

Implemented from Scratch in C

🚀 Overview

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!

✨ Features

  • 🔢 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.

📥 Installation

To install the tool, follow these steps:

1️⃣ Clone the Repository

git clone https://github.com/AS-0167/SHA-256.git
cd SHA-256

2️⃣ Build the Executable

make

3️⃣ Install the CLI System-Wide

sudo make install

This installs the tool as sha-256-hash in /usr/local/bin, making it accessible from anywhere in the terminal. ✅


⚙️ Usage

Once installed, you can run the tool using the following syntax:

sha-256-hash --fpath <file_path> --sha256path <output_path>

📌 Example

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

⚠️ Error Handling

  • ❌ 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.

❌ Uninstallation

To remove the tool from your system, run:

sudo make uninstall

This deletes the installed binary from /usr/local/bin/sha-256-hash. 🗑️


🛠 Development

If you wish to modify or contribute to this project, follow these steps:

1️⃣ Clean Previous Builds

make clean

2️⃣ Delete the Executable

make delete

3️⃣ Run Without Installing

make run

This will execute the tool without installing it system-wide. 🚀


👨‍💻 Author

Developed by [AS]. ✨

For any questions or contributions, feel free to reach out or submit a pull request. 🔥

About

A lightweight, C-based CLI tool to compute SHA-256 hashes of files from scratch — no libraries used. Includes memory checks, output file writing, and Makefile support.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published