sarhash-core 0.1.0

A modular library for password hashing (Argon2) and strength verification (zxcvbn).
Documentation

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