docker: Manually install protobuf to avoid error.

Error: "TypeError: Descriptors cannot not be created directly"

Use pycryptodome ripemd160 implementation else it must be manually enabled in hashlib/openssl.
This commit is contained in:
tecnovert
2022-06-16 14:28:52 +02:00
parent cddc4daf70
commit a51a895141
11 changed files with 102 additions and 896 deletions

View File

@@ -6,7 +6,7 @@
import hashlib
from basicswap.contrib.segwit_addr import bech32_decode, convertbits, bech32_encode
from basicswap.util.crypto import ripemd160
__b58chars = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
@@ -89,7 +89,7 @@ def toWIF(prefix_byte, b, compressed=True):
def getKeyID(bytes):
data = hashlib.sha256(bytes).digest()
return hashlib.new('ripemd160', data).digest()
return ripemd160(data)
def bech32Decode(hrp, addr):

13
basicswap/util/crypto.py Normal file
View File

@@ -0,0 +1,13 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2022 tecnovert
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
from Crypto.Hash import RIPEMD160 # pycryptodome
def ripemd160(data):
h = RIPEMD160.new()
h.update(data)
return h.digest()