Created
August 4, 2012 04:02
-
-
Save jgarzik/3254322 to your computer and use it in GitHub Desktop.
pynode patch for hashlib ripemd160
This file contains hidden or 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
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