From 8d25f180f2c26267ca9ed4b44af44488bb80e487 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Borgstr=C3=B6m?= Date: Tue, 19 Oct 2010 00:14:12 +0200 Subject: [PATCH] Various sha-related performance improvements. --- dedupestore/archiver.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/dedupestore/archiver.py b/dedupestore/archiver.py index 4450f4879..c546a1e5d 100644 --- a/dedupestore/archiver.py +++ b/dedupestore/archiver.py @@ -120,9 +120,10 @@ class Archive(object): data = data[32:] if hashlib.sha256(data).digest() != cid: raise Exception('Invalid chunk checksum') - if hashlib.sha256(zlib.decompress(data)).digest() != id: - raise Exception('Invalid chunk checksum') - fd.write(zlib.decompress(data)) + data = zlib.decompress(data) +# if hashlib.sha256(data).digest() != id: +# raise Exception('Invalid chunk checksum') + fd.write(data) def verify(self): for item in self.items: @@ -134,10 +135,13 @@ class Archive(object): data = self.store.get(NS_CHUNKS, id) cid = data[:32] data = data[32:] - if (hashlib.sha256(data).digest() != cid or - hashlib.sha256(zlib.decompress(data)).digest() != id): + if (hashlib.sha256(data).digest() != cid): logging.error('%s ... ERROR', item['path']) break +# if (hashlib.sha256(data).digest() != cid or +# hashlib.sha256(zlib.decompress(data)).digest() != id): +# logging.error('%s ... ERROR', item['path']) +# break else: logging.info('%s ... OK', item['path'])