}};
}
+use base64::engine::GeneralPurpose;
+use base64::engine::GeneralPurposeConfig;
+use base64::Engine;
+use base64::alphabet;
+static BASE64CONFIG: GeneralPurposeConfig = GeneralPurposeConfig::new().with_decode_allow_trailing_bits(true);
+static BASE64ENGINE: GeneralPurpose = GeneralPurpose::new(&alphabet::STANDARD,BASE64CONFIG);
impl PwdChanCrypto {
#[inline(always)]
fn pbkdf2_decompose(encrypted: &str) -> Result<(usize, Vec<u8>, Vec<u8>), PluginError> {
.ok_or(PluginError::MissingValue)
.and_then(|ab64| {
let s = ab64_to_b64!(ab64);
- base64::decode_config(&s, base64::STANDARD.decode_allow_trailing_bits(true))
+ BASE64ENGINE.decode(&s)
.map_err(|e| {
log_error!(ErrorLevel::Error, "Invalid Base 64 {} -> {:?}", s, e);
PluginError::InvalidBase64
.ok_or(PluginError::MissingValue)
.and_then(|ab64| {
let s = ab64_to_b64!(ab64);
- base64::decode_config(&s, base64::STANDARD.decode_allow_trailing_bits(true))
+ BASE64ENGINE.decode(&s)
.map_err(|e| {
log_error!(ErrorLevel::Error, "Invalid Base 64 {} -> {:?}", s, e);
PluginError::InvalidBase64
PluginError::Format
})?;
// the base64 salt
- base64::encode_config_buf(&salt, base64::STANDARD, &mut output);
+ BASE64ENGINE.encode_string(&salt, &mut output);
// Push the delim
output.push_str("$");
// Finally the base64 hash
- base64::encode_config_buf(&hash_input, base64::STANDARD, &mut output);
+ BASE64ENGINE.encode_string(&hash_input, &mut output);
// Return it
Ok(output)
}