#[non_exhaustive]pub enum BcryptError {
CostNotAllowed(u32),
InvalidHash(&'static str),
Truncation(usize),
Rand(EntropyError),
BatchLengthMismatch {
passwords: usize,
salts: usize,
},
}Expand description
Everything that can go wrong in the public API.
No variant carries attacker-controlled content, so Display is safe to
log on an authentication path.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
CostNotAllowed(u32)
Cost outside the allowed range 4..=31 (bcrypt’s log2(rounds)).
InvalidHash(&'static str)
The hash string is malformed; the payload names the failing part.
Truncation(usize)
A non_truncating_* function received a password of 72 bytes or more.
The payload is the input length including the terminator bcrypt appends.
Rand(EntropyError)
The OS CSPRNG could not produce a salt.
BatchLengthMismatch
A batch function received passwords and salts slices of different
lengths. Batch outputs are position-preserving, so a mismatch has no
meaningful result and is rejected up front.
In verify_many, which takes hashes rather
than salts, the salts field reports the hashes length.
Trait Implementations§
Source§impl Clone for BcryptError
impl Clone for BcryptError
Source§impl Debug for BcryptError
impl Debug for BcryptError
Source§impl Display for BcryptError
impl Display for BcryptError
impl Eq for BcryptError
Source§impl Error for BcryptError
Available on crate feature std only.
impl Error for BcryptError
std only.Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()