Skip to main content

Calculate file hashes super fast!

Project description

File Hash Verification Tool

A Python-based file hashing tool with GUI and TUI modes, disk-aware chunk sizing utilities, and progress display.
Supports MD5, SHA1, SHA256, SHA512 for large files with noticeable speed improvements.

中文文档

Features

  • GUI mode with Tkinter dialogs (falls back to TUI if Tk is unavailable)
  • TUI mode with questionary prompts
  • CLI arguments for direct calculation
  • Disk-type detection helper for recommended chunk size (Windows only)
  • Real-time progress bar with alive-progress
  • Optional hash verification

Performance Comparison

Performance Comparison

The larger the file, the more pronounced the difference becomes.

Installation

pip install -r requirements.txt

Main dependencies:

  • tkinter - GUI dialogs (standard library when available)
  • questionary - TUI prompts
  • alive-progress - Progress bar

Quick Start

GUI mode (default):

python -m hash_calculation

TUI mode:

python -m hash_calculation -t

CLI mode:

python -m hash_calculation -f "C:\path\to\file.iso" -m SHA256
python -m hash_calculation -f "C:\path\to\file.iso" -m SHA256 -c "your_sha256_hash"

Command Line Arguments

  • -t, --tui Use TUI mode (interactive prompts)
  • -f, --file File path for CLI mode
  • -m, --mode Hash algorithm: MD5, SHA1, SHA256, SHA512
  • -c, --compare Optional hash value to verify

Intelligent Chunking

On Windows, helper functions detect disk type to recommend chunk sizes:

  • SSD: 512KB
  • HDD: 256KB
  • Fallback: 1MB when disk type is unknown

Non-Windows systems always use the default chunk size unless you pass a custom one.

Use as a Module

from hash_calculation import calculate_hash_with_progress, get_chunk_size, hash_diff
from pathlib import Path

file_path = Path("path/to/your/file")
algorithm = "SHA256"
chunk_size = get_chunk_size(file_path)
hash_value = calculate_hash_with_progress(file_path, algorithm, chunk_size=chunk_size)
# Optional: Calculate hash without progress bar
# from hash_calculation import calculate_hash
# hash_value = calculate_hash(file_path, algorithm, chunk_size=chunk_size)
print(f"{file_path}'s {algorithm} value is: {hash_value}")

compare_hash = "your_sha256_hash"
if hash_diff(hash_value, compare_hash):
    print("verification successful ✅")
else:
    print("verification failed ❌")
from hash_calculation import get_ssd_or_hdd

disk_types = get_ssd_or_hdd()
for disk, media_type in disk_types.items():
    print(f"Disk {disk}: {media_type}")

Notes

  • Disk type detection only works on Windows
  • Some environments may not return accurate disk media type
  • Large directories are not supported as input; select files only

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hash_calculation-0.0.3.post1.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hash_calculation-0.0.3.post1-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file hash_calculation-0.0.3.post1.tar.gz.

File metadata

  • Download URL: hash_calculation-0.0.3.post1.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for hash_calculation-0.0.3.post1.tar.gz
Algorithm Hash digest
SHA256 26e592a2ed6180881557dbb5722103725246c28ba046ca69ecc8f6273e4468b1
MD5 2d3d169dfd23c2edd168e8b6da2134c6
BLAKE2b-256 35e10523ed433caeb810d9c966cd2e7fb1ee5e8be531ff303480d7910d526cf4

See more details on using hashes here.

File details

Details for the file hash_calculation-0.0.3.post1-py3-none-any.whl.

File metadata

  • Download URL: hash_calculation-0.0.3.post1-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for hash_calculation-0.0.3.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 381aac13a89823b93bcfaf6fd4f758a5a7ab3e79524fbe60f0fd0dd055abf554
MD5 6046e7532fb9fed4da94ad5c431c5fdd
BLAKE2b-256 3b10cec9ceac8863b92684dc952a40bd1a7fa6a34bb0d13246d50e8b06b1cb5d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page