Sha256: 9430a6813c8bde49a2243a08ed6991ae173af9ae01a56b2e5ae17bb2a8ae3b7d

Contents?: true

Size: 572 Bytes

Versions: 4

Compression:

Stored size: 572 Bytes

Contents

extern crate libpasta;
use libpasta::rpassword::*;

struct User {
    // ...
    password_hash: String,
}

fn auth_user(user: &User) {
    let password = prompt_password_stdout("Enter password:").unwrap();
    if libpasta::verify_password(&user.password_hash, &password) {
        println!("The password is correct!");
        // ~> Handle correct password
    } else {
        println!("Incorrect password.");
        // ~> Handle incorrect password
    }
}


fn main() {
    let user = User { password_hash: libpasta::hash_password("hunter2") };
    auth_user(&user);
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
libpasta-0.1.0.pre.rc0-x86_64-linux ext/pasta-bindings/libpasta/examples/verify_password.rs
libpasta-0.0.6-x86_64-linux ext/pasta-bindings/libpasta/examples/verify_password.rs
libpasta-0.0.5 ext/pasta-bindings/libpasta/examples/verify_password.rs
libpasta-0.0.5-x86_64-linux ext/pasta-bindings/libpasta/examples/verify_password.rs