#21022 Add sha2 pre-hashing for passwords #5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This introduces password pre-hashing using sha384 and base64 encoding in order to retain the entropy of passwords greater than 72 bytes in size. The base64 encoding is required to prevent a null byte being present in the hashed password value.
See WordPress#7333 for all the details.
sha384 is used because it results in a string 64 bytes in size being passed to bcrypt, whereas sha512 results in a string 88 bytes in size which causes 16 bytes to be truncated by bcrypt to bring it down to 72 bytes. Truncating a hashed value could introduce an unknown weakness.
The
wp-
prefix is needed to allow differentiating between passwords hashed using this mechanism by WordPress core, versus a password hashed using vanilla bcrypt via one of the several plugins that exist in the ecosystem that implement bcrypt hashing. Not doing so would mean not being able to retain support for passwords stored while one of those plugins were in use.Tickets
Trac ticket: https://core.trac.wordpress.org/ticket/21022
Trac ticket: https://core.trac.wordpress.org/ticket/50027
Benefits
Concerns
wp-
prefix reduces portability between applications other than WordPress