2022-06-16 12:28:52 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2023-12-16 07:29:48 +00:00
|
|
|
# Copyright (c) 2022-2023 tecnovert
|
2022-06-16 12:28:52 +00:00
|
|
|
# Distributed under the MIT software license, see the accompanying
|
|
|
|
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
2023-12-16 07:29:48 +00:00
|
|
|
from Crypto.Hash import RIPEMD160, SHA256 # pycryptodome
|
|
|
|
|
|
|
|
|
|
|
|
def sha256(data):
|
|
|
|
h = SHA256.new()
|
|
|
|
h.update(data)
|
|
|
|
return h.digest()
|
2022-06-16 12:28:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
def ripemd160(data):
|
|
|
|
h = RIPEMD160.new()
|
|
|
|
h.update(data)
|
|
|
|
return h.digest()
|
2023-12-16 07:29:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
def hash160(s):
|
|
|
|
return ripemd160(sha256(s))
|