use yescrypt::{Mode, Params, PasswordHasher, Yescrypt};
use crate::internal::secrets::InternalError;
pub const DEFAULT_N: u64 = 4096;
pub const MIN_N: u64 = u64::MIN;
pub const MAX_N: u64 = u64::MAX;
pub const DEFAULT_R: u32 = 32;
pub const MIN_R: u32 = u32::MIN;
pub const MAX_R: u32 = u32::MAX;
pub const DEFAULT_P: u32 = 1;
pub const MIN_P: u32 = u32::MIN;
pub const MAX_P: u32 = u32::MAX;
pub fn generate_yescrypt(password: &[u8], n: u64, r: u32, p: u32) -> Result<String, InternalError> {
let yescrypt: Yescrypt = Params::new(Mode::default(), n, r, p)?.into();
Ok(yescrypt.hash_password(password)?.to_string())
}