Firebase Scrypt (for Rust)

Pure Rust implementation of Firebase's scrypt password hashing algorithm.

Crates.io Documentation

Installation

Add this to your Cargo.toml

toml [dependencies] firebase-scrypt = "0.1"

Usage

With the simple feature: ```rust use firebase_scrypt::FirebaseScrypt;

const SALTSEPARATOR: &str = "Bw=="; const SIGNERKEY: &str = "jxspr8Ki0RYycVU8zykbdLGjFQ3McFUH0uiiTvC8pVMXAn210wjLNmdZJzxUECKbm0QsEmYUSDzZvpjeJ9WmXA=="; const ROUNDS: u32 = 8; const MEM_COST: u32 = 14;

let firebasescrypt = FirebaseScrypt::new(SALTSEPARATOR, SIGNERKEY, ROUNDS, MEMCOST);

let password = "user1password"; let salt = "42xEC+ixf3L2lw=="; let password_hash ="lSrfV15cpx95/sZS2W9c9Kp6i/LVgQNDNC/qzrCnh1SAyZvqmZqAjTdn3aoItz+VHjoZilo78198JAdRuid5lQ==";

assert!(firebasescrypt.verifypassword(password, salt, password_hash).unwrap()) ```

Use the verify_password function without FirebaseScrypt ```rust use firebasescrypt::verifypassword;

const SALTSEPARATOR: &str = "Bw=="; const SIGNERKEY: &str = "jxspr8Ki0RYycVU8zykbdLGjFQ3McFUH0uiiTvC8pVMXAn210wjLNmdZJzxUECKbm0QsEmYUSDzZvpjeJ9WmXA=="; const ROUNDS: u32 = 8; const MEM_COST: u32 = 14;

let password = "user1password"; let salt = "42xEC+ixf3L2lw=="; let password_hash ="lSrfV15cpx95/sZS2W9c9Kp6i/LVgQNDNC/qzrCnh1SAyZvqmZqAjTdn3aoItz+VHjoZilo78198JAdRuid5lQ==";

let isvalid = verifypassword( password, passwordhash, salt, SALTSEPARATOR, SIGNERKEY, ROUNDS, MEMCOST, ).unwrap(); ```

MSRV

The minimum supported Rust version is: 1.59