Skip to content

Conversation

@tarcieri
Copy link
Member

@tarcieri tarcieri commented Mar 4, 2023

The Salt and SaltString types are wrappers for B64-encoded salt strings as used by the PHC string format.

These API changes make it clearer that the input string needs to be B64-encoded.

The old API is preserved but with deprecations to ease upgrades.

The following methods were renamed:

  • Salt::new => Salt::from_b64
  • Salt::b64_decode => Salt::decode_b64 (for consistency)
  • SaltString::new => SaltString::from_b64
  • SaltString::b64_decode => SaltString::decode_b64
  • SaltString::b64_encode => SaltString::encode_b64

The Salt::as_bytes and SaltString::as_bytes methods were removed, as they return the B64-encoded string as bytes, rather than decoding B64 to bytes, which is what a user might be expecting.

The `Salt` and `SaltString` types are wrappers for B64-encoded salt
strings as used by the PHC string format.

These API changes make it clearer that the input string needs to be
B64-encoded.

The old API is preserved but with deprecations to ease upgrades.

The following methods were renamed:

- `Salt::new` => `Salt::from_b64`
- `Salt::b64_decode` => `Salt::decode_b64` (for consistency)
- `SaltString::new` => `SaltString::from_b64`
- `SaltString::b64_decode` => `SaltString::decode_b64`
- `SaltString::b64_encode` => `SaltString::encode_b64`

The `Salt::as_bytes` and `SaltString::as_bytes` methods were removed, as
they return the B64-encoded string as bytes, rather than decoding B64 to
bytes, which is what a user might be expecting.
@tarcieri tarcieri merged commit 74e85e7 into master Mar 4, 2023
@tarcieri tarcieri deleted the password-hash/salt-method-clarity-improvements branch March 4, 2023 18:32
@tarcieri tarcieri mentioned this pull request Mar 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants