xuan-luo's picture
download
raw
630 Bytes
#!/usr/bin/env python3
import hashlib,json,sys
from pathlib import Path
root=Path(__file__).resolve().parents[1]
data=json.loads((root/'MANIFEST.json').read_text())
errors=[]
for item in data['files']:
p=root/item['path']
if not p.is_file() or p.stat().st_size!=item['size']:
errors.append(item['path']); continue
h=hashlib.sha256()
with p.open('rb') as f:
for block in iter(lambda:f.read(8*1024*1024),b''): h.update(block)
if h.hexdigest()!=item['sha256']: errors.append(item['path'])
if errors: raise SystemExit('Manifest mismatch: '+repr(errors))
print(f"Verified {len(data['files'])} files and all SHA256 checksums")

Xet Storage Details

Size:
630 Bytes
·
Xet hash:
8d180a33098135a5504dc5c52e3489b0fcba9cae118c474ea4736686d1f04375

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.