Skip to content

Commit 0780741

Browse files
committed
password-hash: remove Display/FromStr bounds on Params (#2212)
For the associated type `CustomizedPasswordHasher::Params`, removes the `Display` and `FromStr` bounds which aren't actually used: for PHC-related purposes which are the only ones implemented directly in `password-hash`, it instead requires a `TryFrom<phc::ParamsString>` impl instead. Requiring these as well seemed like good hygiene so there's some way to serialize and parse the params as a string, but it becomes a problem when the params are shared between e.g. PHC and MCF implementations where each of them has a different params serialization so there's not one "true" serialization for which it actually makes sense to impl `Display` and `FromStr`.
1 parent 2187175 commit 0780741

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

password-hash/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "password-hash"
3-
version = "0.6.0-rc.9"
3+
version = "0.6.0-rc.10"
44
authors = ["RustCrypto Developers"]
55
edition = "2024"
66
rust-version = "1.85"

password-hash/src/lib.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,7 @@ pub type PasswordHash = phc::PasswordHash;
5656
#[allow(deprecated)]
5757
pub type PasswordHashString = phc::PasswordHashString;
5858

59-
use core::{
60-
fmt::{Debug, Display},
61-
str::FromStr,
62-
};
59+
use core::fmt::Debug;
6360

6461
#[cfg(feature = "rand_core")]
6562
use rand_core::TryCryptoRng;
@@ -122,7 +119,7 @@ pub trait PasswordHasher<H> {
122119
/// Generic around a password hash to be returned (typically [`PasswordHash`])
123120
pub trait CustomizedPasswordHasher<H> {
124121
/// Algorithm-specific parameters.
125-
type Params: Clone + Debug + Default + Display + FromStr;
122+
type Params: Clone + Debug + Default;
126123

127124
/// Compute a [`PasswordHash`] from the provided password using an
128125
/// explicit set of customized algorithm parameters as opposed to the

0 commit comments

Comments
 (0)