|
@@ -55,9 +55,9 @@ def sha_to_hex(sha):
|
|
|
def hex_to_sha(hex):
|
|
|
"""Takes a hex sha and returns a binary sha"""
|
|
|
sha = ''
|
|
|
- for i in range(0,19):
|
|
|
- sha += chr(int(hex[i:i+2], 16))
|
|
|
- assert len(sha) == 20, "Incorrent length of sha1"
|
|
|
+ for i in range(0,20):
|
|
|
+ sha += chr(int(hex[i*2:i*2+2], 16))
|
|
|
+ assert len(sha) == 20, "Incorrent length of sha1: %d" % len(sha)
|
|
|
return sha
|
|
|
|
|
|
class ShaFile(object):
|