def test_base58_decode():
    assert base58_decode(b"1") == bytearray([0])
    assert base58_decode(b"2") == bytearray([1])
    assert base58_decode(b"21") == bytearray([58])
    assert base58_decode(b"211") == bytearray([13, 36])
    assert base58_decode(b"1211") == bytearray([0, 13, 36])
    assert base58_decode(b"111211") == bytearray([0, 0, 0, 13, 36])
    assert base58check_decode(b"1PfJpZsjreyVrqeoAfabrRwwjQyoSQMmHH") \
        == bytearray(unhexlify(b"00f8917303bfa8ef24f292e8fa1419b20460ba064d"))
Beispiel #2
0
 def from_base58check(data: bytes):
     return Address.from_bytearray(base58check_decode(data))
def test_base58_roundtrip():
    s = b"xprv9wTYmMFdV23N2TdNG573QoEsfRrWKQgWeibmLntzniatZvR9BmLnvSxqu53Kw1UmYPxLgboyZQaXwTCg8MSY3H2EU4pWcQDnRnrVA1xe8fs"
    v = base58check_decode(s)
    assert base58check_encode(v) == s
    assert base58check_decode(base58check_encode(v)) == v
Beispiel #4
0
 def from_base58check(secp: Secp256k1, data: bytes):
     return ExtendedPublicKey.from_bytearray(secp, base58check_decode(data))