wp_hash

函式
wp_hash ( $data, $scheme = 'auth' )
引數
  • (string) $data Plain text to hash.
    Required:
  • (string) $scheme Authentication scheme (auth, secure_auth, logged_in, nonce).
    Required:
    Default: 'auth'
返回值
  • (string) Hash of $data.
定義位置
相關方法
wp_slashwp_headwp_unslashwp_dashboardwp_rss
引入
2.0.3
棄用
-

wp_hash: 這個函式用於生成一個字串的雜湊值。它把要雜湊的字串作為一個引數,並返回雜湊的字串。

獲取給定字串的雜湊值。

function wp_hash( $data, $scheme = 'auth' ) {
		$salt = wp_salt( $scheme );

		return hash_hmac( 'md5', $data, $salt );
	}
endif;

if ( ! function_exists( 'wp_hash_password' ) ) :
	/**
	 * Creates a hash (encrypt) of a plain text password.
	 *
	 * For integration with other applications, this function can be overwritten to
	 * instead use the other package password checking 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.
	 */

常見問題

FAQs
檢視更多 >