password_worker/hasher.rs
1/// Implement this to use your own hashing algorithm with this library
2pub trait Hasher: 'static {
3 /// The Config type for your hash algorithm
4 type Config: Send + Sync + 'static;
5 /// This is the Error you return from your hash library
6 type Error: std::error::Error + Send + Sync + 'static;
7 /// Use your hasher to create a hash from the password (data) and a Config instance.
8 fn hash(data: impl AsRef<[u8]>, config: &Self::Config) -> Result<String, Self::Error>;
9 /// Verify whether the password (data) and hash match.
10 fn verify(data: impl AsRef<[u8]>, hash: &str) -> Result<bool, Self::Error>;
11}