Crate firebase_scrypt

source ·
Expand description

Implementation of Firebase Scrypt in pure Rust.

If you are only using the raw functions instead of the higher-level struct FirebaseScrypt, it’s recommended to disable default features in your Cargo.toml

firebase-scrypt = { version = "0.1", default-features = false }

Usage (with simple feature)

use firebase_scrypt::FirebaseScrypt;

const SALT_SEPARATOR: &str = "Bw==";
const SIGNER_KEY: &str = "jxspr8Ki0RYycVU8zykbdLGjFQ3McFUH0uiiTvC8pVMXAn210wjLNmdZJzxUECKbm0QsEmYUSDzZvpjeJ9WmXA==";
const ROUNDS: u32 = 8;
const MEM_COST: u32 = 14;

let firebase_scrypt = FirebaseScrypt::new(SALT_SEPARATOR, SIGNER_KEY, ROUNDS, MEM_COST);

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

assert!(firebase_scrypt.verify_password(password, salt, password_hash).unwrap())



  • Struct to simplify the usage of hash generation and checking.