File Hasher

👤 johnnywang2001 📦 v1.0.0 ⭐ 4.5 ⬇️ 764 下载
🔒 IT运维与安全 免费

📖 技能介绍


name: file-hasher description: Compute, verify, and compare file hashes using MD5, SHA-1, SHA-256, SHA-512, and more. Use when checking file integrity, verifying downloads against expected checksums, comparing files for equality, generating checksums for directories, hashing strings, or validating checksum files (sha256sum/md5sum format). Supports BSD and standard output formats, JSON output, multi-algorithm hashing, and recursive directory scanning. No external dependencies.


File Hasher

Compute, verify, and compare file hashes. Supports all hashlib algorithms. Zero dependencies.

Quick Start

# Hash a file (SHA-256)
python3 scripts/file_hasher.py hash myfile.txt

# Verify a download
python3 scripts/file_hasher.py verify image.iso -e abc123def456...

# Compare two files
python3 scripts/file_hasher.py compare file1.txt file2.txt

Commands

hash

Compute file hash with one or more algorithms:

python3 scripts/file_hasher.py hash file.txt                        # SHA-256
python3 scripts/file_hasher.py hash file.txt -a md5                 # MD5
python3 scripts/file_hasher.py hash file.txt -a md5,sha1,sha256     # Multiple
python3 scripts/file_hasher.py hash *.py --bsd                      # BSD format
python3 scripts/file_hasher.py hash data.bin --json                 # JSON output

verify

Check a file against an expected hash:

python3 scripts/file_hasher.py verify image.iso -e <expected_hash>
python3 scripts/file_hasher.py verify file.tar.gz -e <hash> -a sha512

小葱技能7w4.net持续更新中。

Exit code 0 = match, 1 = mismatch.

check

Verify files from a checksum file (sha256sum/md5sum/BSD format):

python3 scripts/file_hasher.py check SHA256SUMS
python3 scripts/file_hasher.py check checksums.txt -a md5

Auto-detects algorithm from hash length and BSD format headers.

compare

Compare two files by hash:

python3 scripts/file_hasher.py compare original.bin copy.bin
python3 scripts/file_hasher.py compare a.txt b.txt -a md5

directory

Hash all files in a directory:

python3 scripts/file_hasher.py directory ./src                  # Top level
python3 scripts/file_hasher.py directory ./project -r           # Recursive
python3 scripts/file_hasher.py directory ./dist -r --bsd -a md5 # BSD + MD5

string

Hash a text string directly:

python3 scripts/file_hasher.py string "hello world"
python3 scripts/file_hasher.py string "password" -a md5,sha256,sha512

algorithms

List all available hash algorithms:

python3 scripts/file_hasher.py algorithms

🤖 AI 评测

这是一个非常实用的文件完整性校验工具,支持多种哈希算法,文档清晰,操作简单,零依赖安装方便。整体质量良好,但缺少自动化测试,偶有边界情况处理不完善。日常文件校验和下载验证需求完全能满足。

📊 多维度评分

适应性4.3
规范性4.3
有效性4.8
可靠性4.4
可信度4.5

📁 包含文件 (3 个)

📄 SKILL.md 2.5 KB
📄 _meta.json 130 B
📄 scripts/file_hasher.py 10.1 KB