sarhash-core

Crates.iosarhash-core
lib.rssarhash-core
version0.1.0
created_at2025-12-12 17:39:28.379732+00
updated_at2025-12-12 17:39:28.379732+00
descriptionA modular library for password hashing (Argon2) and strength verification (zxcvbn).
homepage
repositoryhttps://github.com/saroj/sarhash-core
max_upload_size
id1981904
size29,703
Saroj Bhattarai (3sarojbhattarai)

documentation

README

sarhash-core

sarhash-core is a modular Rust library designed for secure password operations. It combines Argon2 hashing with zxcvbn strength estimation.

Features

  • Secure Hashing: Uses the Argon2id algorithm via the argon2 crate.
  • Strength Verification: Estimates password strength using zxcvbn.
  • Easy-to-use API: Simple functions for hashing, verifying, and checking strength.

Installation

Add this to your Cargo.toml:

[dependencies]
sarhash-core = "0.1.0"

Usage

use sarhash_core::{hash_password, verify_password, check_strength};

fn main() {
    let password = "correct horse battery staple";

    // 1. Check Strength
    let strength = check_strength(password);
    println!("Score: {}/4", strength.score);

    // 2. Hash Password
    let hash = hash_password(password).expect("hashing failed");
    println!("Hash: {}", hash);

    // 3. Verify Password
    let is_valid = verify_password(password, &hash).expect("verification failed");
    assert!(is_valid);
}

License

MIT

Commit count: 0

cargo fmt