pub fn generate_raw_hash(
    password: &str,
    salt: &str,
    salt_separator: &str,
    signer_key: &str,
    rounds: u32,
    mem_cost: u32
) -> Result<Vec<u8>, GenerateHashError>
Expand description

Generates a hash in the form of a Vec<u8>

In case you want or are using the same hash representation as Firebase, use the FirebaseScrypt struct to get the Base64 hashed directly.

Example (generate Base64 hash)

// Base64 crate for encoding the hash
use base64::encode;
use firebase_scrypt::generate_raw_hash;

const SALT_SEPARATOR: &str = "Bw==";
const SIGNER_KEY: &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 hash = encode(generate_raw_hash(
    password,
    salt,
    SALT_SEPARATOR,
    SIGNER_KEY,
    ROUNDS,
    MEM_COST,
).unwrap());

assert_eq!(hash, password_hash);