#!/usr/bin/env python3 """Verify recorded release bytes. Hash agreement is not source authentication.""" import hashlib,json,sys from pathlib import Path R=Path(__file__).resolve().parents[1] def main(): m=json.loads((R/'MANIFEST.json').read_text());bad=[] for name,expected in m['files'].items(): p=R/name if not p.is_file() or hashlib.sha256(p.read_bytes()).hexdigest()!=expected:bad.append(name) print(json.dumps({'status':'RELEASE_BYTES_MATCH' if not bad else 'MISMATCH','files_checked':len(m['files']),'failed':bad,'boundary':'Byte comparison only. Review external SHA-256 custody separately.'},indent=2)) return bool(bad) if __name__=='__main__':raise SystemExit(main())