mirror of https://github.com/nucypher/nucypher.git
Signature r+s concatenation serialization.
parent
24bbac9ae1
commit
440e3e13b6
|
@ -43,8 +43,14 @@ class Signature(object):
|
|||
return encode_dss_signature(self.r, self.s)
|
||||
|
||||
def __bytes__(self):
|
||||
"""
|
||||
Implements the __bytes__ call for Signature to transform into a
|
||||
transportable mode.
|
||||
"""
|
||||
return self.sig_as_bytes
|
||||
# A couple quick assertions to be sure this is OK. Remove these at some point.
|
||||
assert self.r.to_bytes(33, "big")[0] == 0, "Is 32 bytes enough?"
|
||||
assert self.s.to_bytes(33, "big")[0] == 0, "Is 32 bytes enough?"
|
||||
return self.r.to_bytes(32, "big") + self.s.to_bytes(32, "big")
|
||||
|
||||
def __len__(self):
|
||||
return len(bytes(self))
|
||||
|
||||
def __add__(self, other):
|
||||
return bytes(self) + other
|
||||
__radd__ = __add__
|
||||
|
|
Loading…
Reference in New Issue