WP_Application_Passwords::chunk_password() WordPress Method
The WP_Application_Passwords::chunk_password() method is used to break a password into chunks for transport. This is useful when storing passwords in a database or other storage system that imposes a maximum length on the data that can be stored. By breaking the password into multiple chunks, it can be stored in multiple records, each under the maximum length. When retrieving the password, the chunks can be concatenated to reconstruct the original password.
WP_Application_Passwords::chunk_password( string $raw_password ) #
Sanitizes and then splits a password into smaller chunks.
Parameters
- $raw_password
(string)(Required)The raw application password.
Return
(string) The chunked password.
Source
File: wp-includes/class-wp-application-passwords.php
public static function chunk_password( $raw_password ) { $raw_password = preg_replace( '/[^a-z\d]/i', '', $raw_password ); return trim( chunk_split( $raw_password, 4, ' ' ) ); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
5.6.0 | Introduced. |