From 077ce424d11c8344dc4d95bc5b5fa88d67adf643 Mon Sep 17 00:00:00 2001 From: zyp Date: Thu, 19 Oct 2006 15:54:21 +0000 Subject: [project @ zyp-20061019155421-ad427e9a8f491d9c] [project @ 60] Using multihash.hash_file(). --- pyanidb/hash.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/pyanidb/hash.py b/pyanidb/hash.py index 35c05ae..70f49af 100644 --- a/pyanidb/hash.py +++ b/pyanidb/hash.py @@ -1,15 +1,5 @@ import multihash, threading, time -def file_hash(name, algorithms): - h = multihash.Multihash(*algorithms) - f = open(name) - data = f.read(32768) - while data: - h.update(data) - data = f.read(32768) - f.close() - return h - class Hashthread(threading.Thread): def __init__(self, filelist, hashlist, algorithms, *args, **kwargs): self.filelist = filelist @@ -20,7 +10,7 @@ class Hashthread(threading.Thread): try: while 1: f = self.filelist.pop(0) - h = file_hash(f, self.algorithms) + h = multihash.hash_file(f, self.algorithms) self.hashlist.append((f, h)) except IndexError: return -- cgit v1.2.3