凡自治之物 · LGD 治理学 · 创造术家族 | 评测协议:见平台质量门禁规范
English
When to use
- After a file download, transfer or upload, to verify that no bit-rot, corruption or tampering occurred.
- When an independent integrity manifest must be generated as a distribution credential for later client-side re-verification.
- In version control, backup/restore or multi-party collaboration, when file fingerprints must be recorded to ensure ongoing consistency and keep audit evidence.
Usage
- Run the Python script from the command line:
python hash_check.py— zero-dependency. - Core parameters:
--input(file or directory path) and--action(mode: check / generate / compare). - To batch-check a directory, pass the full path and set the output to JSON to fit automated pipelines.
Workflow
- Initialize the script runtime; confirm the Python environment and stdlib (e.g. hashlib) are healthy.
- Upload or point at the local target file/directory; ensure read/write permissions and correct paths.
- Start the compute module: walk the directory or read the single file, hashing block by block and aggregating into a SHA-256 value.
- The script auto-compares against the provided hashes (if expected values are configured) and returns a pass/fail status code to the console.
- Save the verification result to a log file or the designated JSON output location, forming a tamper-evident credential record.
Evidence & safety statement
- Evidence: TBD (no evaluation / badge link yet; update here once it is produced)
- Version: 1.0.1
- Security: no independent security scan has been performed (TBD); the conclusion is pending and no endorsement is given until it is completed.
中文
何时用
- 在文件下载、传输或上传完成后,用于校验数据是否发生比特翻转、损坏或被人为篡改。
- 当需要生成一份独立的完整性清单(Manifest)作为分发凭证时,用于后续客户端二次比对验证。
- 在进行版本控制、系统备份恢复或多方协作场景下,需记录文件指纹以确保持续一致性并保留审计证据。
用法
- 直接通过命令行执行 Python 脚本,主要命令格式为
python hash_check.py,支持无依赖运行。 - 核心参数包括
--input(指定输入文件或目录路径)和--action(校验模式:check/generate/compare)。 - 若需要批量校验目录结构,需传入完整路径并配置输出格式为 JSON 以适配自动化流程。
流程
- 初始化脚本环境,确认当前 Python 运行环境与依赖库(如 hashlib)状态正常。
- 上传或指定本地目标文件/目录,确保输入源权限可读写且路径无误。
- 启动计算模块,遍历目录结构或读取单个文件并逐块哈希聚合生成 SHA-256 值。
- 脚本自动比对双方提供的哈希值(如配置了预期值),并在控制台返回通过或失败状态码。
- 将验证结果保存至日志文件或指定 JSON 输出位置,形成不可篡改的凭证留存记录。
证据与安全声明
- 证据:TBD(暂无评测/徽章链接;产生后在此更新实际链接)
- 版本:1.0.1
- 安全:未做独立安全扫描(TBD),结论待补;补全前不作推荐背书。
