]> git.mxchange.org Git - quix0rs-apt-p2p.git/blobdiff - hash.py
fix bugs in stringify
[quix0rs-apt-p2p.git] / hash.py
diff --git a/hash.py b/hash.py
index 7f42f3152cd6e0082e24b9058d874a10c18b9a98..4210385b5632969095880e38094dab92c0ca1946 100644 (file)
--- a/hash.py
+++ b/hash.py
@@ -12,7 +12,9 @@ def intify(hstr):
 def stringify(int):
     str = hex(int)[2:]
     if str[-1] == 'L':
-       str = str[:1]
+       str = str[:-1]
+    if len(str) % 2 != 0:
+       str = '0' + str
     str = str.decode('hex')
     return (20 - len(str)) *'\x00' + str