One Hat Cyber Team
Your IP :
216.73.216.183
Server IP :
23.137.84.82
Server :
Linux srv25.usacloudserver.us 5.14.0-570.39.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Sep 4 05:08:52 EDT 2025 x86_64
Server Software :
LiteSpeed
PHP Version :
8.1.33
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
lib64
/
python3.9
/
site-packages
/
borg
/
testsuite
/
View File Name :
chunker_slow.py
from hashlib import sha256 from io import BytesIO from binascii import unhexlify from .chunker import cf from ..chunker import Chunker from ..constants import * # NOQA from . import BaseTestCase def H(data): return sha256(data).digest() class ChunkerRegressionTestCase(BaseTestCase): def test_chunkpoints_unchanged(self): def twist(size): x = 1 a = bytearray(size) for i in range(size): x = (x * 1103515245 + 12345) & 0x7FFFFFFF a[i] = x & 0xFF return a data = twist(100000) runs = [] for winsize in (65, 129, HASH_WINDOW_SIZE, 7351): for minexp in (4, 6, 7, 11, 12): for maxexp in (15, 17): if minexp >= maxexp: continue for maskbits in (4, 7, 10, 12): for seed in (1849058162, 1234567653): fh = BytesIO(data) chunker = Chunker(seed, minexp, maxexp, maskbits, winsize) chunks = [H(c) for c in cf(chunker.chunkify(fh, -1))] runs.append(H(b''.join(chunks))) # The "correct" hash below matches the existing chunker behavior. # Future chunker optimisations must not change this, or existing repos will bloat. overall_hash = H(b''.join(runs)) self.assert_equal(overall_hash, unhexlify("a43d0ecb3ae24f38852fcc433a83dacd28fe0748d09cc73fc11b69cf3f1a7299"))