pegase 0.2.0

Cli to generate secret config files from yaml recipe
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use pbkdf2::{Algorithm, Params, PasswordHasher, Pbkdf2};

use crate::internal::secrets::InternalError;

pub const DEFAULT_ROUNDS: u32 = Params::RECOMMENDED_ROUNDS;
pub const MIN_ROUNDS: u32 = Params::MIN_ROUNDS;
pub const MAX_ROUNDS: u32 = u32::MAX;

pub fn generate_pbkdf2(password: &[u8], rounds: u32) -> Result<String, InternalError> {
    let pbkdf2 = Pbkdf2::new(Algorithm::RECOMMENDED, Params::new(rounds)?);

    Ok(pbkdf2.hash_password(password)?.to_string())
}