def hash160(data, hash=hashlib.sha256):
    """A standard compound hash."""
    try:
        if hash.ripe_hash:
            return ripemd160(hash.ripe_hash(data).digest()).digest()
        else:
            return ripemd160(hash(data).digest()).digest()
    except AttributeError:
        return ripemd160(hash(data).digest()).digest()
Example #2
0
def hash160(data, hash=hashlib.sha256):
    """A standard compound hash."""
    try:
        if hash.ripe_hash:
            return ripemd160(hash.ripe_hash(data).digest()).digest()
        else:
            return ripemd160(hash(data).digest()).digest()
    except AttributeError:
        return ripemd160(hash(data).digest()).digest()
Example #3
0
def hash160(data):
    """A standard compound hash."""
    return ripemd160(hashlib.sha256(data).digest()).digest()
Example #4
0

BASE58_ALPHABET = b'123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
BASE58_BASE = len(BASE58_ALPHABET)
BASE58_LOOKUP = dict((c, i) for i, c in enumerate(BASE58_ALPHABET))


class EncodingError(Exception):
    pass


def ripemd160(data):
    return hashlib.new("ripemd160", data)

try:
    ripemd160(b'').digest()
except Exception:
    # stupid Google App Engine hashlib doesn't support ripemd160 for some stupid reason
    # import it from pycrypto. You need to add
    # - name: pycrypto
    #   version: "latest"
    # to the "libraries" section of your app.yaml
    from Crypto.Hash.RIPEMD import RIPEMD160Hash as ripemd160


def to_long(base, lookup_f, s):
    """
    Convert an array to a (possibly bignum) integer, along with a prefix value
    of how many prefixed zeros there are.

    base:
def hash160(data):
    """A standard compound hash."""
    return ripemd160(hashlib.sha256(data).digest()).digest()
BASE58_ALPHABET = b'123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
BASE58_BASE = len(BASE58_ALPHABET)
BASE58_LOOKUP = dict((c, i) for i, c in enumerate(BASE58_ALPHABET))


class EncodingError(Exception):
    pass


def ripemd160(data):
    return hashlib.new("ripemd160", data)


try:
    ripemd160(b'').digest()
except Exception:
    # stupid Google App Engine hashlib doesn't support ripemd160 for some stupid reason
    # import it from pycrypto. You need to add
    # - name: pycrypto
    #   version: "latest"
    # to the "libraries" section of your app.yaml
    from Crypto.Hash.RIPEMD import RIPEMD160Hash as ripemd160


def to_long(base, lookup_f, s):
    """
    Convert an array to a (possibly bignum) integer, along with a prefix value
    of how many prefixed zeros there are.

    base:
Example #7
0
def hash160():
    return ripemd160(hashlib.sha256(data).digest()).digest()
Example #8
0
def ripe160(data):
    """A standard single RIPE MD 160 hash."""
    return ripemd160(data).digest()