|
@@ 72-77 (lines=6) @@
|
| 69 |
|
*/ |
| 70 |
|
function hash_equals( $known_string, $user_string ) { |
| 71 |
|
// Strict type checking as in PHP's native implementation |
| 72 |
|
if ( !is_string( $known_string ) ) { |
| 73 |
|
trigger_error( 'hash_equals(): Expected known_string to be a string, ' . |
| 74 |
|
gettype( $known_string ) . ' given', E_USER_WARNING ); |
| 75 |
|
|
| 76 |
|
return false; |
| 77 |
|
} |
| 78 |
|
|
| 79 |
|
if ( !is_string( $user_string ) ) { |
| 80 |
|
trigger_error( 'hash_equals(): Expected user_string to be a string, ' . |
|
@@ 79-84 (lines=6) @@
|
| 76 |
|
return false; |
| 77 |
|
} |
| 78 |
|
|
| 79 |
|
if ( !is_string( $user_string ) ) { |
| 80 |
|
trigger_error( 'hash_equals(): Expected user_string to be a string, ' . |
| 81 |
|
gettype( $user_string ) . ' given', E_USER_WARNING ); |
| 82 |
|
|
| 83 |
|
return false; |
| 84 |
|
} |
| 85 |
|
|
| 86 |
|
$known_string_len = strlen( $known_string ); |
| 87 |
|
if ( $known_string_len !== strlen( $user_string ) ) { |