wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren
wp_hash › WordPress Function
Seit2.0.3
Veraltetn/v
› wp_hash ( $data, $scheme = 'auth', $algo = 'md5' )
Parameter: (3) |
|
Gibt zurück: |
|
Definiert in: |
|
Codex: | |
Changelog: |
|
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.Quellcode
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 * @since 6.8.0 The password is now hashed using bcrypt by default instead of phpass. * * @global PasswordHash $wp_hasher phpass object. * * @param string $password Plain text user password to hash. * @return string The hash string of the password. */