From 0c9c1c7cd74843756260fc9bcf049e0cba90f96e Mon Sep 17 00:00:00 2001 From: ZakDggn <23458039+ZakDggn@users.noreply.github.com> Date: Tue, 18 Mar 2025 14:49:48 +0000 Subject: [PATCH 1/2] Implement Display for HashParts instead of ToString directly --- src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index b1b14b9..a65aa45 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -53,7 +53,7 @@ pub enum Version { #[cfg(any(feature = "alloc", feature = "std"))] impl HashParts { /// Creates the bcrypt hash string from all its parts - fn format(self) -> String { + fn format(&self) -> String { self.format_for_version(Version::TwoB) } @@ -84,9 +84,9 @@ impl FromStr for HashParts { } #[cfg(any(feature = "alloc", feature = "std"))] -impl ToString for HashParts { - fn to_string(&self) -> String { - self.format_for_version(Version::TwoY) +impl fmt::Display for HashParts { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}", self.format()) } } From d1592d511662f67212eb3d3abe6c1656bf4a928e Mon Sep 17 00:00:00 2001 From: ZakDggn <23458039+ZakDggn@users.noreply.github.com> Date: Mon, 24 Mar 2025 02:14:14 +0000 Subject: [PATCH 2/2] Update hash_with_fixed_salt test to use bcrypt version 2b --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index a65aa45..c147580 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -534,7 +534,7 @@ mod tests { .unwrap() .to_string(); assert_eq!( - "$2y$05$HlFShUxTu4ZHHfOLJwfmCeDj/kuKFKboanXtDJXxCC7aIPTUgxNDe", + "$2b$05$HlFShUxTu4ZHHfOLJwfmCeDj/kuKFKboanXtDJXxCC7aIPTUgxNDe", &hashed ); }