Git Product home page Git Product logo

password-hashes's Introduction

RustCrypto: Password Hashes

Project Chat Apache2/MIT licensed Dependency Status

Collection of password hashing algorithms, otherwise known as password-based key derivation functions, written in pure Rust.

Supported Algorithms

Algorithm Crate Crates.io Documentation MSRV
Argon2 argon2 crates.io Documentation MSRV 1.65
Balloon balloon‑hash crates.io Documentation MSRV 1.65
bcrypt‑pbkdf bcrypt‑pbkdf crates.io Documentation MSRV 1.60
PBKDF2 pbkdf2 crates.io Documentation MSRV 1.60
scrypt scrypt crates.io Documentation MSRV 1.60
SHA-crypt sha‑crypt crates.io Documentation MSRV 1.60

Please see the OWASP Password Storage Cheat Sheet for assistance in selecting an appropriate algorithm for your use case.

Usage

The following code example shows how to verify a password when stored using one of many possible password hashing algorithms implemented in this repository.

use password_hash::{PasswordHash, PasswordVerifier};

use argon2::Argon2;
use pbkdf2::Pbkdf2;
use scrypt::Scrypt;

// Can be: `$argon2`, `$pbkdf2`, or `$scrypt`
let hash_string = "$argon2i$v=19$m=65536,t=1,p=1$c29tZXNhbHQAAAAAAAAAAA$+r0d29hqEB0yasKr55ZgICsQGSkl0v0kgwhd+U3wyRo";
let input_password = "password";

let password_hash = PasswordHash::new(&hash_string).expect("invalid password hash");

// Trait objects for algorithms to support
let algs: &[&dyn PasswordVerifier] = &[&Argon2::default(), &Pbkdf2, &Scrypt];

password_hash.verify_password(algs, input_password).expect("invalid password");

Minimum Supported Rust Version (MSRV) Policy

MSRV bumps are considered breaking changes and will be performed only with minor version bump.

License

All crates licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

password-hashes's People

Contributors

alex avatar antonok-edm avatar aumetra avatar awidegreen avatar brycx avatar cbzehner avatar chantsune avatar daxpedda avatar dependabot[bot] avatar dzvon avatar falko17 avatar hdevalence avatar ibotty avatar jaysonsantos avatar koushiro avatar li-kai avatar liamrosenfeld avatar michaeljones avatar minacode avatar nathanielknight avatar newpavlov avatar numenorean avatar oddgrd avatar pjottos avatar rlee287 avatar slightknack avatar striezel avatar tarcieri avatar touilleman avatar tshepang avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.