mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-23 00:07:38 +00:00
Various sha-related performance improvements.
This commit is contained in:
parent
52870eb2d8
commit
8d25f180f2
1 changed files with 9 additions and 5 deletions
|
@ -120,9 +120,10 @@ def extract(self, dest=None):
|
||||||
data = data[32:]
|
data = data[32:]
|
||||||
if hashlib.sha256(data).digest() != cid:
|
if hashlib.sha256(data).digest() != cid:
|
||||||
raise Exception('Invalid chunk checksum')
|
raise Exception('Invalid chunk checksum')
|
||||||
if hashlib.sha256(zlib.decompress(data)).digest() != id:
|
data = zlib.decompress(data)
|
||||||
raise Exception('Invalid chunk checksum')
|
# if hashlib.sha256(data).digest() != id:
|
||||||
fd.write(zlib.decompress(data))
|
# raise Exception('Invalid chunk checksum')
|
||||||
|
fd.write(data)
|
||||||
|
|
||||||
def verify(self):
|
def verify(self):
|
||||||
for item in self.items:
|
for item in self.items:
|
||||||
|
@ -134,10 +135,13 @@ def verify(self):
|
||||||
data = self.store.get(NS_CHUNKS, id)
|
data = self.store.get(NS_CHUNKS, id)
|
||||||
cid = data[:32]
|
cid = data[:32]
|
||||||
data = data[32:]
|
data = data[32:]
|
||||||
if (hashlib.sha256(data).digest() != cid or
|
if (hashlib.sha256(data).digest() != cid):
|
||||||
hashlib.sha256(zlib.decompress(data)).digest() != id):
|
|
||||||
logging.error('%s ... ERROR', item['path'])
|
logging.error('%s ... ERROR', item['path'])
|
||||||
break
|
break
|
||||||
|
# if (hashlib.sha256(data).digest() != cid or
|
||||||
|
# hashlib.sha256(zlib.decompress(data)).digest() != id):
|
||||||
|
# logging.error('%s ... ERROR', item['path'])
|
||||||
|
# break
|
||||||
else:
|
else:
|
||||||
logging.info('%s ... OK', item['path'])
|
logging.info('%s ... OK', item['path'])
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue