Exemplo n.º 1
0
	def getIdentity( self, length = 16 ) :
		"""
:param int length: The length of hex bytes to be returned. Defaults to '16'. If a number greater than the available `identity` string is passed, the whole `identity` hash will be returned.
		"""
		ret = self.identity[:length]
		if self.reverse :
			true_str = 'F' * length
			return xor_str( true_str.decode('hex'), ret.decode('hex') ).encode('hex')
		return ret
Exemplo n.º 2
0
    def checkIdentity(self, identity):
        """
:param str identity: The identity hash of the `Orchestrator` object to be checked for compatibility.
:rtype bool:
:return: Returns `True` if the `Orchestrator` with the passed identity is compatible, `False` if it has the same specs but needs the `reverse` argument toggled, and `None` if it is incompatible (initialized with different *password*, *tag_length*, *streams*, etc).

		"""
        length = len(identity)
        my_id = self.getIdentity(length)
        if identity == my_id: return False
        ret = xor_str(my_id.decode('hex'), identity.decode('hex'))
        if ret == '\xFF' * len(ret):
            return True
        return None