mirror of
https://github.com/basicswap/basicswap.git
synced 2025-11-05 18:38:09 +01:00
Replace all hashlib ripemd160 functions.
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
name = "basicswap"
|
||||
|
||||
__version__ = "0.12.1"
|
||||
__version__ = "0.12.2"
|
||||
|
||||
@@ -83,9 +83,6 @@ def set_regtest() -> None:
|
||||
def sha256(s):
|
||||
return hashlib.new('sha256', s).digest()
|
||||
|
||||
def ripemd160(s):
|
||||
return hashlib.new('ripemd160', s).digest()
|
||||
|
||||
def hash256(s):
|
||||
return sha256(sha256(s))
|
||||
|
||||
|
||||
@@ -37,10 +37,6 @@ MAX_SCRIPT_OPCODES = 201
|
||||
|
||||
OPCODE_NAMES = {}
|
||||
|
||||
def hash160(s):
|
||||
return hashlib.new('ripemd160', sha256(s)).digest()
|
||||
|
||||
|
||||
_opcode_instances = []
|
||||
class CScriptOp(int):
|
||||
"""A single script opcode"""
|
||||
|
||||
@@ -68,9 +68,6 @@ mininode_lock = RLock()
|
||||
def sha256(s):
|
||||
return hashlib.new('sha256', s).digest()
|
||||
|
||||
def ripemd160(s):
|
||||
return hashlib.new('ripemd160', s).digest()
|
||||
|
||||
def hash256(s):
|
||||
return sha256(sha256(s))
|
||||
|
||||
|
||||
@@ -37,10 +37,6 @@ MAX_SCRIPT_OPCODES = 201
|
||||
|
||||
OPCODE_NAMES = {}
|
||||
|
||||
def hash160(s):
|
||||
return hashlib.new('ripemd160', sha256(s)).digest()
|
||||
|
||||
|
||||
_opcode_instances = []
|
||||
class CScriptOp(int):
|
||||
"""A single script opcode"""
|
||||
|
||||
@@ -51,9 +51,6 @@ MSG_TYPE_MASK = 0xffffffff >> 2
|
||||
def sha256(s):
|
||||
return hashlib.new('sha256', s).digest()
|
||||
|
||||
def ripemd160(s):
|
||||
return hashlib.new('ripemd160', s).digest()
|
||||
|
||||
def hash256(s):
|
||||
return sha256(sha256(s))
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ from basicswap.util import (
|
||||
i2b,
|
||||
ensure,
|
||||
)
|
||||
from basicswap.util.crypto import hash160
|
||||
from basicswap.util.address import decodeAddress
|
||||
from basicswap.chainparams import Coins
|
||||
from basicswap.interface.contrib.firo_test_framework.script import (
|
||||
@@ -22,7 +23,6 @@ from basicswap.interface.contrib.firo_test_framework.script import (
|
||||
OP_HASH160,
|
||||
OP_CHECKSIG,
|
||||
OP_EQUALVERIFY,
|
||||
hash160,
|
||||
)
|
||||
from basicswap.interface.contrib.firo_test_framework.mininode import (
|
||||
CBlock,
|
||||
|
||||
@@ -25,6 +25,7 @@ from basicswap.interface.contrib.nav_test_framework.mininode import (
|
||||
FromHex,
|
||||
uint256_from_str,
|
||||
)
|
||||
from basicswap.util.crypto import hash160
|
||||
from basicswap.util.address import (
|
||||
decodeWif,
|
||||
pubkeyToAddress,
|
||||
@@ -39,7 +40,6 @@ from basicswap.basicswap_util import (
|
||||
)
|
||||
|
||||
from basicswap.interface.contrib.nav_test_framework.script import (
|
||||
hash160,
|
||||
CScript,
|
||||
OP_0,
|
||||
OP_EQUAL,
|
||||
|
||||
@@ -1,13 +1,23 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2022 tecnovert
|
||||
# Copyright (c) 2022-2023 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
|
||||
from Crypto.Hash import RIPEMD160, SHA256 # pycryptodome
|
||||
|
||||
|
||||
def sha256(data):
|
||||
h = SHA256.new()
|
||||
h.update(data)
|
||||
return h.digest()
|
||||
|
||||
|
||||
def ripemd160(data):
|
||||
h = RIPEMD160.new()
|
||||
h.update(data)
|
||||
return h.digest()
|
||||
|
||||
|
||||
def hash160(s):
|
||||
return ripemd160(sha256(s))
|
||||
|
||||
Reference in New Issue
Block a user