src/Client.php
private function compareHash( $hash1, $hash2 ) {
		$result = strlen( $hash1 ) ^ strlen( $hash2 );
		$len = min( strlen( $hash1 ), strlen( $hash2 ) ) - 1;
		for ( $i = 0; $i < $len; $i++ ) {
			$result |= ord( $hash1{$i} ) ^ ord( $hash2{$i} );
		}
		return $result == 0;
	}
private function compareHash( $hash1, $hash2 ) {
		$result = strlen( $hash1 ) ^ strlen( $hash2 );
		$len = min( strlen( $hash1 ), strlen( $hash2 ) ) - 1;
		for ( $i = 0; $i < $len; $i++ ) {
			$result |= ord( $hash1{$i} ) ^ ord( $hash2{$i} );
		}
		return $result == 0;
	}
private function compareHash ( $ hash1 , $ hash2 ) { $ result = strlen ( $ hash1 ) ^ strlen ( $ hash2 ) ; $ len = min ( strlen ( $ hash1 ) , strlen ( $ hash2 ) ) - 1 ; for ( $ i = 0 ; $ i < $ len ; $ i ++ ) { $ result |= ord ( $ hash1 { $ i } ) ^ ord ( $ hash2 { $ i } ) ; } return $ result == 0 ; }
Constant time comparison
@param string $hash1
@param string $hash2
@return bool
Constant time comparison