- Timestamp:
- 02/17/2025 11:22:33 AM (3 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-application-passwords.php
r59754 r59828 61 61 * @since 5.6.0 62 62 * @since 5.7.0 Returns WP_Error if application name already exists. 63 * @since 6.8.0 The hashed password value now uses wp_fast_hash() instead of phpass. 63 64 * 64 65 * @param int $user_id User ID. … … 96 97 97 98 $new_password = wp_generate_password( static::PW_LENGTH, false ); 98 $hashed_password = wp_hash_password( $new_password );99 $hashed_password = self::hash_password( $new_password ); 99 100 100 101 $new_item = array( … … 125 126 * 126 127 * @since 5.6.0 128 * @since 6.8.0 The hashed password value now uses wp_fast_hash() instead of phpass. 127 129 * 128 130 * @param int $user_id The user ID. … … 250 252 * 251 253 * @since 5.6.0 254 * @since 6.8.0 The actual password should now be hashed using wp_fast_hash(). 252 255 * 253 256 * @param int $user_id User ID. … … 297 300 * 298 301 * @since 5.6.0 302 * @since 6.8.0 The password is now hashed using wp_fast_hash() instead of phpass. 303 * Existing passwords may still be hashed using phpass. 299 304 * 300 305 * @param int $user_id The user ID. … … 468 473 return trim( chunk_split( $raw_password, 4, ' ' ) ); 469 474 } 475 476 /** 477 * Hashes a plaintext application password. 478 * 479 * @since 6.8.0 480 * 481 * @param string $password Plaintext password. 482 * @return string Hashed password. 483 */ 484 public static function hash_password( 485 #[\SensitiveParameter] 486 string $password 487 ): string { 488 return wp_fast_hash( $password ); 489 } 490 491 /** 492 * Checks a plaintext application password against a hashed password. 493 * 494 * @since 6.8.0 495 * 496 * @param string $password Plaintext password. 497 * @param string $hash Hash of the password to check against. 498 * @return bool Whether the password matches the hashed password. 499 */ 500 public static function check_password( 501 #[\SensitiveParameter] 502 string $password, 503 string $hash 504 ): bool { 505 return wp_verify_fast_hash( $password, $hash ); 506 } 470 507 }
Note: See TracChangeset
for help on using the changeset viewer.