SabaPivot's picture
Upgrade all claim evidence using high-scoring peer protocols with attribution
854f51d verified
Raw History Blame Contribute Delete
462 Bytes
#!/usr/bin/env python3
import hashlib
from pathlib import Path
r=Path(__file__).resolve().parent;o=r/'BUNDLE_SHA256SUMS.txt'
def d(p):
h=hashlib.sha256()
with p.open('rb') as f:
for b in iter(lambda:f.read(1<<20),b''):h.update(b)
return h.hexdigest()
rows=[f'{d(p)} {p.relative_to(r).as_posix()}' for p in sorted(r.rglob('*')) if p.is_file() and p!=o and '__pycache__' not in p.parts];o.write_text('\n'.join(rows)+'\n');print(f'wrote {len(rows)} entries')