function.hash

function.hash

[code=python] ¶
#Python 2.7 ¶
import hashlib ¶

algo = 'ripemd160' ¶
data = 'The quick brown fox jumped over the lazy dog.' ¶

h = hashlib.new(algo) ¶
h.update(data) ¶
[/code] ¶

When you want to get digest as hex string, ¶
[code=python] ¶
result = h.hexdigest() ¶
# result will be '8eb208f7e05d987a9b044a8e98c6b087f15a0bfc' ¶
[/code] ¶

or as raw binary, ¶
[code=python] ¶
result = h.digest() ¶
# result will be '\x8e\xb2\x08\xf7\xe0]\x98z\x9b\x04J\x8e\x98\xc6\xb0\x87\xf1Z\x0b\xfc' ¶
[/code] ¶