Пример #1
0
def address_from_public_key(pubkey: bytes):
    """Returns the base32-encoded version of public key bytes (G...)"""
    address = bytearray()
    address.append(6 << 3)  # version -> 'G'
    address.extend(pubkey)
    address.extend(_crc16_checksum(bytes(address)))  # checksum

    return base32.encode(address)
Пример #2
0
 def test_encode(self):
     for a, b in self.vectors:
         self.assertEqual(base32.encode(a), b)