pybit/py3/block.py
def PK2Addr(pk: hex,
                debug: bool=False) -> str:
        """
        pk = public key in hex
        """
        # Decode input to binary
        pk = codecs.decode(pk, "hex")
        if debug:
            print("{0}pk: {1}".format(" "*6, codecs.encode(pk, "hex")))

        # Hash SHA256
        h = hash_SHA256_ripemd160(pk)
        if debug:
            print("{0}SHA256: h1: {1}".format(" "*6, codecs.encode(h, "hex")))

        # Add version
        h = b"\00" + h
        if debug:
            print("{0}version + h1: {1}".format(
                            " "*6, codecs.encode(h, "hex")))

        # Hash SHA256
        h2 = hash_SHA256_twice(h)
        if debug:
            print("{0}h2: {1}".format(" "*6, codecs.encode(h2, "hex")))

        # Get checksum
        cs = h2[0:4]
        if debug:
            print("{0}checksum: {1}".format(" "*6, codecs.encode(cs, "hex")))
            print("{0}h2 + cs: {1}".format(" "*6,
                                           codecs.encode(h2 + cs, "hex")))

        # Add checksum and convert to base58
        b58 = base58.b58encode(h + cs)
        if debug:
            print("{0}b58: {1}".format(" "*6, b58))

        return b58

        pk = public key in hex
        
pk = public key in hex
pk = public key in hex
def PK2Addr(pk: hex,
                debug: bool=False) -> str:
        pk = codecs.decode(pk, "hex")
        if debug:
            print("{0}pk: {1}".format(" "*6, codecs.encode(pk, "hex")))
        h = hash_SHA256_ripemd160(pk)
        if debug:
            print("{0}SHA256: h1: {1}".format(" "*6, codecs.encode(h, "hex")))
        h = b"\00" + h
        if debug:
            print("{0}version + h1: {1}".format(
                            " "*6, codecs.encode(h, "hex")))
        h2 = hash_SHA256_twice(h)
        if debug:
            print("{0}h2: {1}".format(" "*6, codecs.encode(h2, "hex")))
        cs = h2[0:4]
        if debug:
            print("{0}checksum: {1}".format(" "*6, codecs.encode(cs, "hex")))
            print("{0}h2 + cs: {1}".format(" "*6,
                                           codecs.encode(h2 + cs, "hex")))
        b58 = base58.b58encode(h + cs)
        if debug:
            print("{0}b58: {1}".format(" "*6, b58))
        return b58
def PK2Addr ( pk : hex , debug : bool = False ) -> str : pk = codecs . decode ( pk , "hex" ) if debug : print ( "{0}pk: {1}" . format ( " " * 6 , codecs . encode ( pk , "hex" ) ) ) h = hash_SHA256_ripemd160 ( pk ) if debug : print ( "{0}SHA256: h1: {1}" . format ( " " * 6 , codecs . encode ( h , "hex" ) ) ) h = b"\00" + h if debug : print ( "{0}version + h1: {1}" . format ( " " * 6 , codecs . encode ( h , "hex" ) ) ) h2 = hash_SHA256_twice ( h ) if debug : print ( "{0}h2: {1}" . format ( " " * 6 , codecs . encode ( h2 , "hex" ) ) ) cs = h2 [ 0 : 4 ] if debug : print ( "{0}checksum: {1}" . format ( " " * 6 , codecs . encode ( cs , "hex" ) ) ) print ( "{0}h2 + cs: {1}" . format ( " " * 6 , codecs . encode ( h2 + cs , "hex" ) ) ) b58 = base58 . b58encode ( h + cs ) if debug : print ( "{0}b58: {1}" . format ( " " * 6 , b58 ) ) return b58
pk = public key in hex
pk = public key in hex
"""
        pk = public key in hex
        """ # Decode input to binary # Hash SHA256 # Add version # Hash SHA256 # Get checksum # Add checksum and convert to base58
pk
hex
debug
bool