Typical byte-like methods.

pull/149/head
jMyles 2017-12-20 21:49:24 -08:00
parent 2cfd0b2ab3
commit c52a5ce800
1 changed files with 12 additions and 0 deletions

View File

@ -570,6 +570,18 @@ class Ursula(Character):
def __bytes__(self):
return Ursula.hash(self.pubkey_sig_bytes + self.interface_hrac)
def __add__(self, other):
return bytes(self) + other
def __radd__(self, other):
return other + bytes(self)
def __hash__(self):
return int.from_bytes(self, byteorder="big")
def __eq__(self, other):
return bytes(self) == bytes(other)
def interface_dht_key(self):
return self.InterfaceDHTKey(self.seal, self.interface_hrac())