@@ -2633,8 +2633,8 @@ function wp_hash_password( $password ) {
26332633 */
26342634 $ options = apply_filters ( 'wp_hash_password_options ' , array () );
26352635
2636- // Use sha384 to retain entropy from a password that's longer than 72 bytes, and a wp-sha384- prefix for domain separation.
2637- $ password_to_hash = base64_encode ( hash ( 'sha384 ' , ' wp-sha384- ' . trim ( $ password ), true ) );
2636+ // Use sha384 to retain entropy from a password that's longer than 72 bytes, and a wp-sha384 key for domain separation.
2637+ $ password_to_hash = base64_encode ( hash_hmac ( 'sha384 ' , trim ( $ password ), ' wp-sha384 ' , true ) );
26382638
26392639 // Add a `wp-` prefix to facilitate distinguishing vanilla bcrypt hashes.
26402640 return 'wp- ' . password_hash ( $ password_to_hash , PASSWORD_BCRYPT , $ options );
@@ -2696,7 +2696,7 @@ function wp_check_password( $password, $hash, $user_id = '' ) {
26962696 $ check = false ;
26972697 } elseif ( str_starts_with ( $ hash , 'wp- ' ) ) {
26982698 // Check the password using the current `wp-` prefixed hash.
2699- $ password_to_verify = base64_encode ( hash ( 'sha384 ' , 'wp-sha384- ' . $ password , true ) );
2699+ $ password_to_verify = base64_encode ( hash_hmac ( 'sha384 ' , $ password , 'wp-sha384 ' , true ) );
27002700 $ check = password_verify ( $ password_to_verify , substr ( $ hash , 3 ) );
27012701 } elseif ( str_starts_with ( $ hash , '$P$ ' ) ) {
27022702 // Check the password using phpass.
0 commit comments