Download research/tools/verify_integrity.py from PureOne/LIORAEN-Omega: direct link, hf CLI and curl.
- Browser
- Download file 787 Bytes
-
https://huggingface.co/datasets/PureOne/LIORAEN-Omega/resolve/main/research/tools/verify_integrity.py
- Command line
-
hf download hf://datasets/PureOne/LIORAEN-Omega/research/tools/verify_integrity.py
-
curl -L -o verify_integrity.py https://huggingface.co/datasets/PureOne/LIORAEN-Omega/resolve/main/research/tools/verify_integrity.py
787 Bytes
| """Verify delivered payload hashes, rejecting traversal and missing files.""" | |
| from pathlib import Path | |
| import hashlib,json,sys | |
| ROOT=Path(__file__).resolve().parents[1] | |
| def main(): | |
| entries=[] | |
| for line in (ROOT/'SHA256SUMS.txt').read_text().splitlines(): | |
| if not line.strip():continue | |
| digest,name=line.split(' ',1) | |
| path=(ROOT/name).resolve() | |
| if not path.is_relative_to(ROOT):raise RuntimeError('unsafe manifest path') | |
| if not path.is_file():raise RuntimeError(f'missing file: {name}') | |
| actual=hashlib.sha256(path.read_bytes()).hexdigest() | |
| if actual!=digest:raise RuntimeError(f'SHA-256 mismatch: {name}') | |
| entries.append(name) | |
| print(f'PASS: {len(entries)} file SHA-256 hashes match.') | |
| if __name__=='__main__':main() | |