Research source · python

build-release.py

site/public/evidence/dehn-filled-quantum-trace/phase-free-nahm-attack/build-release.py

34 lines. Source is displayed for inspection; it is not executed by this page.

File fingerprint

SHA-256: a8523e89d421a53fdc7e724e6e9041904d2ed5c4c4ef9dc767f2ff01795569d5

#!/usr/bin/env python3
"""Reproduce exact results and package the supporting research note."""
from pathlib import Path
import hashlib
import json
import subprocess
import sys
import zipfile

root=Path(__file__).resolve().parent
run=subprocess.run([sys.executable,str(root/'verify-phase-free-nahm.py')],capture_output=True,text=True,check=True,cwd=root)
(root/'verification-output.txt').write_text(run.stdout)
result=json.loads((root/'exact-results.json').read_text())
assert result['status']=='passed'
archive='phase-free-nahm-attack.zip'
excluded={archive,'SHA256SUMS.txt','ARCHIVE-SHA256.txt','archive-validation.txt'}
payload=sorted(p for p in root.iterdir() if p.is_file() and p.name not in excluded)
digest=lambda data:hashlib.sha256(data).hexdigest()
(root/'SHA256SUMS.txt').write_text(''.join(f'{digest(p.read_bytes())}  {p.name}\n' for p in payload))
with zipfile.ZipFile(root/archive,'w') as z:
    for p in sorted(payload+[root/'SHA256SUMS.txt']):
        info=zipfile.ZipInfo(p.name,(2026,9,8,0,0,0));info.external_attr=0o100644<<16
        z.writestr(info,p.read_bytes(),compress_type=zipfile.ZIP_DEFLATED,compresslevel=9)
sha=digest((root/archive).read_bytes())
(root/'ARCHIVE-SHA256.txt').write_text(f'{sha}  {archive}\n')
with zipfile.ZipFile(root/archive) as z:
    assert z.testzip() is None
    for p in payload+[root/'SHA256SUMS.txt']:assert z.read(p.name)==p.read_bytes()
(root/'archive-validation.txt').write_text(
    f"PASS: {result['check_count']} exact checks; quadratic series tails certified.\n"
    f"PASS: {len(payload)} payload files hashed and matched after extraction.\n"
    f"Archive SHA-256: {sha}\n"
    'Scope: one actual triangulation and a symbolic slope family; unrestricted conjecture open.\n')
print((root/'archive-validation.txt').read_text(),end='')