^ 回到顶部
  • 人生没有定律,每个人都有自己的节奏
  • 本站wordpress建站教程均通过实践后发布,希望对你有帮助
  • 希望你的坚持,都是因为热爱,而不是因为不甘心
  • 8年wordpress建站经验,5星服务品质
  • 那些不愿意让你吃亏的人,才是真正值得你深交的人,也是值得你付出时间的人
  • 阿里云2核2g仅需86元/年

wordpress函数hash_equals()用法示例

hash_equals( string $a,  string $b )

Timing attack safe string comparison


描述

Compares two strings using the same time whether they’re equal or not.

新用户2核2g仅需86元/年    领取1153套模板    免费cdn流量包    ¥3188礼包

This function was added in PHP 5.6.

Note: It can leak the length of a string when arguments of differing length are supplied.


参数

$a

(string)
(Required)
Expected string.

$b

(string)
(Required)
Actual, user supplied, string.


返回值

(bool) Whether strings are equal.


源代码

File: wp-includes/compat.php

function hash_equals( $a, $b ) {
	$a_length = strlen( $a );
	if ( $a_length !== strlen( $b ) ) {
		return false;
	}
	$result = 0;

	// Do not attempt to "optimize" this.
	for ( $i = 0; $i < $a_length; $i++ ) {
		$result |= ord( $a[ $i ] ) ^ ord( $b[ $i ] );
	}

	return $result === 0;
}

更新日志

Version 描述
3.9.2 Introduced.

相关函数

Used By

  • wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php:
    WP_REST_Posts_Controller::get_item_permissions_check()
  • wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php:
    WP_REST_Posts_Controller::can_access_password_content()
  • wp-includes/class-wp-customize-nav-menus.php:
    WP_Customize_Nav_Menus::render_nav_menu_partial()
  • wp-includes/pluggable.php:
    wp_verify_nonce()
  • wp-includes/pluggable.php:
    wp_check_password()
  • wp-includes/pluggable.php:
    wp_validate_auth_cookie()
  • wp-includes/user.php:
    check_password_reset_key()
  • wp-includes/class-wp-customize-widgets.php:
    WP_Customize_Widgets::sanitize_widget_instance()
  • Show 3 more used by
    Hide more used by


让小雨知道,这篇文章帮到了你
扫码关注微信公众号zs40086(微搜片)随时随地微信看片,抢先福利电影等你来

热门推荐

如有疑问,请前往问答中心反馈!

反馈