public static function timingSafeEquals($safe, $user)
	{
		// Use builtin has comparison function available when running on PHP 5.6+
		if(function_exists('hash_equals'))
		{
			return hash_equals((string)$safe, (string)$user);
		}
		
		$safe .= chr(0);
		$user .= chr(0);

		$safeLen = strlen($safe);
		$userLen = strlen($user);
		$result = $safeLen - $userLen;

		for($i = 0; $i < $userLen; $i++)
		{
			$result |= (ord($safe[$i % $safeLen]) ^ ord($user[$i]));
		}

		return $result === 0;
	}