Created
May 9, 2020 15:46
-
-
Save bjarnemagnussen/f6d72a6ce25fd51f060b311c5654a761 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from hashlib import new, sha256 as _sha256, sha512 as _sha512 | |
import hmac as _hmac | |
from coincurve import PrivateKey as ECPrivateKey, PublicKey as ECPublicKey | |
def sha256(bytestr): | |
return _sha256(bytestr).digest() | |
def double_sha256(bytestr): | |
return _sha256(_sha256(bytestr).digest()).digest() | |
def double_sha256_checksum(bytestr): | |
return double_sha256(bytestr)[:4] | |
def ripemd160_sha256(bytestr): | |
return new('ripemd160', sha256(bytestr)).digest() | |
hash160 = ripemd160_sha256 | |
def hmac_sha512(key, bytestr): | |
return _hmac.new(key, bytestr, _sha512).digest() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment