| Crates.io | sha-rs |
| lib.rs | sha-rs |
| version | 0.1.0 |
| created_at | 2025-01-13 14:46:06.108297+00 |
| updated_at | 2025-01-13 14:46:06.108297+00 |
| description | This project is a pure Rust implementation of three widely used cryptographic hash algorithms: SHA-1, SHA-256, and SHA-512. These algorithms are implemented from scratch, without relying on external libraries for the core hashing logic. |
| homepage | |
| repository | https://github.com/Truthixify/sha.git |
| max_upload_size | |
| id | 1514693 |
| size | 20,228 |
This project is a pure Rust implementation of three widely used cryptographic hash algorithms: SHA-1, SHA-256, and SHA-512. These algorithms are implemented from scratch, without relying on external libraries for the core hashing logic.
To build and test this project, you need:
Clone the repository:
git clone https://github.com/truthixify/sha.git
cd sha
use sha::{Sha, sha256};
fn main() {
let data = b"hello world";
// Compute SHA-256 hash
let hasher = Sha256::new();
let hash = hasher.digest(data);
println!("SHA-256: {}", hash);
}
sha1(data: &[u8]) -> Stringsha256(data: &[u8]) -> [Stringsha512(data: &[u8]) -> StringThe project includes comprehensive test cases using official test vectors from the specifications. To run the tests:
cargo test
hex (for encoding/decoding hex strings)Contributions are welcome! If you'd like to contribute, please:
git checkout -b feature-xyz).git commit -m 'Add feature xyz').git push origin feature-xyz).Happy hashing!