Crate libpasta [] [src]

Pasta - Password Storage

Making passwords painless

This is a library designed to make secure password storage easy.

For a more comprehensive introduction, see: https://libpasta.github.io/

Examples

The basic functionality for computing password hashes is:

extern crate libpasta;
// We re-export the rpassword crate for CLI password input.
use libpasta::rpassword::*;

fn main() {
    let password = prompt_password_stdout("Please enter your password:").unwrap();
    let password_hash = libpasta::hash_password(password);
    println!("The stored password is: '{}'", password_hash);
}

Supported formats

libpasta attempts to support some legacy formats. For example, the bcrypt format $2y$....

Modules

config

Configuration module

errors

libpasta errors.

hashing

Password hashing functionality

key

The key module is for managing key sources.

primitives

Primitive in libpasta refers to the raw hashing algorithms as implemented in many libraries.

rpassword

Re-export rpassword for convenience.

Macros

benches

Structs

Cleartext

A simple wrapper for a password to denote it is a cleartext password.

Functions

hash_password

Generates a default hash for a given password.

migrate_hash

Migrate the input hash to the current recommended hash.

verify_password

Verifies the provided password matches the inputted hash string.

verify_password_update_hash

Verifies a supplied password against a previously computed password hash, and performs an in-place update of the hash value if the password verifies. Hence this needs to take a mutable String reference.