returns the binary version of the SEC format
(self, compressed=True)
| 403 | return total.x.num == sig.r |
| 404 | |
| 405 | def sec(self, compressed=True): |
| 406 | '''returns the binary version of the SEC format''' |
| 407 | # if compressed, starts with b'\x02' if self.y.num is even, b'\x03' if self.y is odd |
| 408 | # then self.x.num |
| 409 | # remember, you have to convert self.x.num/self.y.num to binary (some_integer.to_bytes(32, 'big')) |
| 410 | if compressed: |
| 411 | if self.y.num % 2 == 0: |
| 412 | return b'\x02' + self.x.num.to_bytes(32, 'big') |
| 413 | else: |
| 414 | return b'\x03' + self.x.num.to_bytes(32, 'big') |
| 415 | else: |
| 416 | # if non-compressed, starts with b'\x04' followod by self.x and then self.y |
| 417 | return b'\x04' + self.x.num.to_bytes(32, 'big') + \ |
| 418 | self.y.num.to_bytes(32, 'big') |
| 419 | |
| 420 | def hash160(self, compressed=True): |
| 421 | return hash160(self.sec(compressed)) |
no outgoing calls