aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatarChristoph Goehre <christoph.goehre@gmx.de>2008-01-21 12:05:59 +0100
committerLibravatarChristoph Goehre <christoph.goehre@gmx.de>2008-01-21 12:05:59 +0100
commitc843a4d2822c5d0fa44afe2086a12b2f9ad58688 (patch)
tree0f2fb1a9fee470a9bcea3802e35c79bc19c037b4
parent607e3c772fd6d39b40e544d815d457a8248333c1 (diff)
fix SHA256 hash generation without /usr/bin/sha256sum
-rwxr-xr-xmini-dinstall8
1 files changed, 4 insertions, 4 deletions
diff --git a/mini-dinstall b/mini-dinstall
index 92f3831..f3fc6d7 100755
--- a/mini-dinstall
+++ b/mini-dinstall
@@ -1172,14 +1172,14 @@ class ArchiveDirIndexer(threading.Thread):
buf = f.read(8192)
return shasum.hexdigest()
elif type == 'sha256':
- import Crypto.Hash.SHA256
+ from Crypto.Hash import SHA256
f = open(filename)
buf = f.read(8192)
- shasum256 = SHA256.new(buf)
+ shasum256 = SHA256.new()
while buf != '':
- shasum256.hash_update(buf)
+ shasum256.update(buf)
buf = f.read(8192)
- return shasum256.hash_digest()
+ return shasum256.hexdigest()
else:
raise DinstallException('cannot compute hash of type %s; no builtin method or /usr/bin/%ssum', type, type)