"""Verify the downloaded handoff without extra packages.""" import hashlib import json from pathlib import Path root = Path(__file__).resolve().parent manifest = json.loads((root / 'FILES_SHA256.json').read_text()) for relative, info in manifest.items(): path = root / relative if not path.resolve().is_relative_to(root): raise SystemExit('Unsafe manifest path: ' + relative) if not path.is_file() or path.stat().st_size != info['bytes']: raise SystemExit('Missing or wrong size: ' + relative) with path.open('rb') as stream: actual = hashlib.file_digest(stream, 'sha256').hexdigest() if actual != info['sha256']: raise SystemExit('SHA256 mismatch: ' + relative) print(f'PASS: {len(manifest)} files verified; this is a compact results package, not full trajectories or media.')