strata-native-lm / verify.py
nur-dev's picture
STRATA Native LM: non-commercial release
1d60d59 verified
Raw History Blame Contribute Delete
1.01 kB
#!/usr/bin/env python3
"""Verify the SHA-256 manifest for the STRATA Native LM v1 release."""
from __future__ import annotations
import hashlib
from pathlib import Path
def digest(path: Path) -> str:
value = hashlib.sha256()
with path.open("rb") as handle:
for block in iter(lambda: handle.read(1024 * 1024), b""):
value.update(block)
return value.hexdigest()
def main() -> None:
root = Path(__file__).resolve().parent
manifest = root / "MANIFEST.sha256"
failures: list[str] = []
entries = 0
for line in manifest.read_text(encoding="utf-8").splitlines():
if not line:
continue
expected, relative = line.split(" ", 1)
path = root / relative
entries += 1
if not path.is_file() or digest(path) != expected:
failures.append(relative)
if failures:
raise SystemExit(f"verification failed: {failures}")
print(f"VERIFIED {entries} files")
if __name__ == "__main__":
main()