MCPcopy Index your code
hub / github.com/Rust-Web-Development/code / verify_password

Function verify_password

ch_09/src/routes/authentication.rs:75–85  ·  view source on GitHub ↗
(
    hash: &str,
    password: &[u8],
)

Source from the content-addressed store, hash-verified

73}
74
75fn verify_password(
76 hash: &str,
77 password: &[u8],
78) -> Result<bool, argon2::password_hash::Error> {
79 let parsed_hash = PasswordHash::new(hash)?;
80 match Argon2::default().verify_password(password, &parsed_hash) {
81 Ok(()) => Ok(true),
82 Err(argon2::password_hash::Error::Password) => Ok(false),
83 Err(e) => Err(e),
84 }
85}
86
87fn make_key() -> PasetoSymmetricKey<V4, PasetoLocal> {
88 PasetoSymmetricKey::<V4, PasetoLocal>::from(Key::from(PASETO_KEY))

Callers 1

loginFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected