def bin_hash160(string): intermed = hashlib.sha256(string).digest() digest = '' if not hasattr(hashlib, 'ripemd160'): hashlib.ripemd160 = RIPEMD160 digest = hashlib.ripemd160(intermed).digest() return digest
def bin_hash160(string): intermed = hashlib.sha256(string).digest() digest = '' if not hasattr(hashlib, 'ripemd160') or \ "ripemd160" not in (hashlib.algorithms if is_python2 else hashlib.algorithms_available): hashlib.ripemd160 = RIPEMD160 digest = hashlib.ripemd160(intermed).digest() return digest
def ripemd_160(text): """hash the content of text text : String or list of String """ h = ripemd160('ripemd160') if type(text) == str: h.update(text.encode('utf-8')) else: #type(text) == list for i in text: h.update(i.encode('utf-8')) return h.hexdigest()
def digitally_sign(source, secret, hasher="md5"): """ >>> digitally_sign("Supercalifragilisticexpialidocious", 'pop song') ('Supercalifragilisticexpialidocious44bf69fb4ac3af50432043ab0f69aaaf', 16) """ hasher = hasher.lower() if hasher == "sha512": secured = hashlib.sha512() elif hasher == "sha384": secured = hashlib.sha384() elif hasher == "sha256": secured = hashlib.sha256() elif hasher == "sha224": secured = hashlib.sha224() elif hasher == "sha1": secured = hashlib.sha1() elif hasher == "ripemd160": secured = hashlib.ripemd160() else: secured = hashlib.md5() secured.update(source.encode('utf-8') + secret.encode('utf-8')) digest = secured.hexdigest() return source + digest, secured.digest_size
def hash160(msg): """ripemd160(sha256(msg)) -> bytes""" return hashlib.ripemd160(hashlib.sha256(msg).digest()).digest()
def bin_ripemd160(string): if not hasattr(hashlib, 'ripemd160'): hashlib.ripemd160 = RIPEMD160 digest = hashlib.ripemd160(string).digest() return digest
def deriveAddress(publicKey): bytes = hexToBytes(publicKey) hash256 = hashlib.sha256().update(bytes).digest() input = Buffer(hashlib.ripemd160().update(hash256).digest()) return __encode(ACCOUNT_PREFIX, input)
def bin_ripemd160(string): if not hasattr(hashlib, 'ripemd160') or "ripemd160" not in hashlib.algorithms: hashlib.ripemd160 = RIPEMD160 digest = hashlib.ripemd160(string).digest() return digest
def bin_ripemd160(string): if not hasattr(hashlib, 'ripemd160') or \ "ripemd160" not in (hashlib.algorithms if is_python2 else hashlib.algorithms_available): hashlib.ripemd160 = RIPEMD160 digest = hashlib.ripemd160(string).digest() return digest
def getHashedAddress(self, publicKey): return hashlib.ripemd160(hashlib.sha256(publicKey))
def ripemd160(msg): """one-line rmd160(msg) -> bytes""" return hashlib.ripemd160(msg).digest()
def hash160(s): return hashlib.ripemd160(hashlib.sha256(s).digest()).digest()
def ripemd160(s): h = hashlib.ripemd160(s.encode()) return h.hexdigest()