# Path: reversecoin/bitcoin/serialize.py
# def Hash(s):
#     return uint256_from_str(hashlib.sha256(hashlib.sha256(s).digest()).digest())
# 
# def ser_uint256(u):
#     rs = b""
#     for i in range(8):
#         rs += struct.pack(b"<I", u & 0xFFFFFFFF)
#         u >>= 32
#     return rs


from reversecoin.bitcoin.serialize import Hash, ser_uint256
from binascii import hexlify, unhexlify
    import sys
# base58.py
# Original source: git://github.com/joric/brutus.git
# which was forked from git://github.com/samrushing/caesure.git
#
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.

from __future__ import absolute_import, division, print_function, unicode_literals


b58_digits = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'


class Base58Error(Exception):
    pass

class InvalidBase58Error(Base58Error):
    pass


# Path: reversecoin/bitcoin/serialize.py
# def Hash(s):
#     return uint256_from_str(hashlib.sha256(hashlib.sha256(s).digest()).digest())
# 
# def ser_uint256(u):
#     rs = b""
#     for i in range(8):
#         rs += struct.pack(b"<I", u & 0xFFFFFFFF)
#         u >>= 32
#     return rs


# Path: reversecoin/bitcoin/base58.py
from reversecoin.bitcoin.serialize import Hash, ser_uint256
from binascii import hexlify, unhexlify
    import sys

# base58.py
# Original source: git://github.com/joric/brutus.git
# which was forked from git://github.com/samrushing/caesure.git
#
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.

from __future__ import absolute_import, division, print_function, unicode_literals


b58_digits = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'


class Base58Error(Exception):
    pass

class InvalidBase58Error(Base58Error):
    pass


def encode(b):