| Crates.io | lonesha256 |
| lib.rs | lonesha256 |
| version | 1.1.0 |
| created_at | 2025-02-13 05:21:23.399716+00 |
| updated_at | 2025-02-13 13:13:41.98318+00 |
| description | Rust bindings for the lonesha256 C library |
| homepage | https://github.com/ankddev/lonesha256/ |
| repository | https://github.com/ankddev/lonesha256/ |
| max_upload_size | |
| id | 1553791 |
| size | 39,107 |
Rust bindings for the lonesha256 C library - a portable, endian-proof, single-file SHA256 implementation
This crate provides Rust bindings for lonesha256, making it easy to use this lightweight SHA256 implementation in your Rust projects.
Add this to your Cargo.toml:
[dependencies]
lonesha256 = "1.0"
or run this command in your terminal:
cargo add lonesha256
use lonesha256::lonesha256;
fn main() {
let input = b"Hello, world!";
let mut hash = [0u8; 32];
lonesha256(&mut hash, input).expect("Failed to compute hash");
println!("Hash: {}",
hash.iter()
.map(|b| format!("{:02x}", b))
.collect::<String>());
}
Library documentation can be found here
clang, as said heregit clone https://github.com/ankddev/lonesha256
cd lonesha256
cargo build --release
Run the included examples:
cargo run --example sample # Basic usage
cargo run --example file_hash # File hashing
cargo run --example streaming # Process data in chunks
cargo run --example hex_output # Different output formats
cargo run --example benchmark # Performance testing
Run the test suite:
cargo test
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)This project is licensed under the MIT License - see the LICENSE file for details.