back to table · edit · history · where entries came from · files · download
1207 bytes, as of the version from 2026-10-28 22:59 (current). Recorded here, not run.
"""Authenticated all-entry readback verification; key on stdin, never logged."""
import json,os,sys
from pathlib import Path
import numberdb.sage as numberdb
from generate import Umemura
from checks import check_values, Q
key=sys.stdin.read().strip()
if '=' in key and key.split('=',1)[0].replace('_','').isupper():
key=key.split('=',1)[1].strip().strip('\"\'')
numberdb.configure(api_key=key)
d=numberdb.table('T558')
assert d == json.loads(Path(__file__).with_name('stored.json').read_text())
rows=d['Numbers']
if isinstance(rows,dict):
rows=[dict(row,params={'n':n}) if isinstance(row,dict) else {'params':{'n':n},'number':row} for n,row in rows.items()]
values={int(r['params']['n']):Q(r['number']) for r in rows}
independent=check_values(values)
g=Umemura();report=g.verify(sample=None)
print(report)
assert report.ok
# Execute the program taken from the live document, not a local surrogate.
ns={}
exec(d['Programs']['program-sage-python']['code'],ns)
assert ns['polynomials']==values
print(json.dumps({'source':'live authenticated numberdb.table readback','all_entry_verify_ok':report.ok,'independent_checks':independent,'stored_program_agrees':True,'environment':g.environment()},indent=2))