Skip to content

RIPEMD160 Hash Error #3

@PuppyCerberus

Description

@PuppyCerberus
def ripmed160(data):
    h = hashlib.new('ripemd160')
    h.update(data)
    return h.digest()

above code will cause a RIPEMD160 HASH error when signing a transaction.

I had to change to in packer.py

from Crypto.Hash import RIPEMD160

def ripemd160(data):
    if isinstance(data, str):
        data = data.encode('utf-8')

    h = RIPEMD160.new()
    h.update(data)
    return h.digest()

also in transaction.py

    def unpack_signature(self, signature: bytes):
        t = Uint8.unpack(signature)
        if t == 0:
            data = signature[Uint8.size: Uint8.size + 65]
            data = data + ripemd160(data + b"K1")[:4]
            return "SIG_K1_" + b58encode(data).decode("ascii")
        elif t == 1:
            raise EosApiException("not implementd")
        else:
            raise EosApiException("invalid binary signature")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions