Skip to content

Instantly share code, notes, and snippets.

@jgarzik
Created August 4, 2012 04:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jgarzik/3254322 to your computer and use it in GitHub Desktop.
Save jgarzik/3254322 to your computer and use it in GitHub Desktop.
pynode patch for hashlib ripemd160
diff --git a/bitcoin/serialize.py b/bitcoin/serialize.py
index 6d7fc6d..13a3afd 100644
--- a/bitcoin/serialize.py
+++ b/bitcoin/serialize.py
@@ -7,6 +7,7 @@
#
import struct
+import hashlib
from Crypto.Hash import SHA256, RIPEMD160
def deser_string(f):
@@ -192,5 +193,7 @@ def Hash(s):
return uint256_from_str(SHA256.new(SHA256.new(s).digest()).digest())
def Hash160(s):
- return uint160_from_str(RIPEMD160.new(SHA256.new(s).digest()).digest())
+ h = hashlib.new('ripemd160')
+ h.update(SHA256.new(s).digest())
+ return uint160_from_str(h.digest())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment