1
0

fix hash in make_offered_htlc

This commit is contained in:
ThomasV
2018-04-17 06:59:21 +02:00
parent 2c717194b2
commit 6ba846bff0
2 changed files with 13 additions and 21 deletions

View File

@@ -198,16 +198,18 @@ def sha256d(x: Union[bytes, str]) -> bytes:
def hash_160(x: bytes) -> bytes:
return ripemd(sha256(public_key))
def ripemd(x):
try:
md = hashlib.new('ripemd160')
md.update(sha256(x))
md.update(x)
return md.digest()
except BaseException:
from . import ripemd
md = ripemd.new(sha256(x))
md = ripemd.new(x)
return md.digest()
def hmac_oneshot(key: bytes, msg: bytes, digest) -> bytes:
if hasattr(hmac, 'digest'):
# requires python 3.7+; faster