From 77ab912d192eba20cacbd2fc08c20abbca076191 Mon Sep 17 00:00:00 2001 From: rasul Date: Thu, 30 Apr 2020 18:31:57 -0500 Subject: [PATCH] test the hash function --- src/hash.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/hash.rs b/src/hash.rs index a144e9c..bfb558d 100644 --- a/src/hash.rs +++ b/src/hash.rs @@ -52,3 +52,17 @@ pub fn salt() -> String { salt } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_hash() { + let password = "butterflies"; + let salt = "cucumbers"; + let hashed = hash(password, salt).unwrap(); + + assert_eq!(hashed, "$argon2i$v=19$m=4096,t=3,p=1$Y3VjdW1iZXJz$r5IYZSVjTOQoW9bGSv3GseB6pcOSEK8btQ8ftJX5wmE"); + } +}