wpseek.com
A WordPress-centric search engine for devs and theme authors
wp_hash › WordPress Function
Since2.0.3
Deprecatedn/a
› wp_hash ( $data, $scheme = 'auth', $algo = 'md5' )
Parameters: (3) |
|
Returns: |
|
Defined at: |
|
Codex: | |
Change Log: |
|
Gets the hash of the given string.
The default algorithm is md5 but can be changed to any algorithm supported byhash_hmac()
. Use the hash_hmac_algos()
function to check the supported
algorithms.Source
function wp_hash( $data, $scheme = 'auth', $algo = 'md5' ) { $salt = wp_salt( $scheme ); // Ensure the algorithm is supported by the hash_hmac function. if ( ! in_array( $algo, hash_hmac_algos(), true ) ) { throw new InvalidArgumentException( sprintf( /* translators: 1: Name of a cryptographic hash algorithm. 2: List of supported algorithms. */ __( 'Unsupported hashing algorithm: %1$s. Supported algorithms are: %2$s' ), $algo, implode( ', ', hash_hmac_algos() ) ) ); } return hash_hmac( $algo, $data, $salt ); } endif; if ( ! function_exists( 'wp_hash_password' ) ) : /** * Creates a hash of a plain text password. * * For integration with other applications, this function can be overwritten to * instead use the other package password hashing algorithm. * * @since 2.5.0 * * @global PasswordHash $wp_hasher PHPass object. * * @param string $password Plain text user password to hash. * @return string The hash string of the password. */