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, intelligent chunking, and progress display.
Supports MD5, SHA1, SHA256, SHA512 for large files with noticeable speed improvements.

中文文档

Features

  • GUI mode with Tkinter dialogs
  • TUI mode with questionary prompts
  • CLI arguments for direct calculation
  • Intelligent chunk size based on SSD/HDD (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
  • 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, the program detects disk type to adjust chunk size:

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

Non-Windows systems always use the default chunk size.

Use as a Module

from hash_calculation import calculate_hash_with_progress, hash_diff
from pathlib import Path

file_path = Path("path/to/your/file")
algorithm = "SHA256"
hash_value = calculate_hash_with_progress(file_path, algorithm)
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.2.tar.gz (6.9 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.2-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file hash_calculation-0.0.2.tar.gz.

File metadata

  • Download URL: hash_calculation-0.0.2.tar.gz
  • Upload date:
  • Size: 6.9 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.2.tar.gz
Algorithm Hash digest
SHA256 eac614efffa74500d7d6c541bf088584eb2fca7e32face34736c226cb1a21d33
MD5 8ee192dbf3874c98eefc1de0c72d7cca
BLAKE2b-256 b76cd04cdd3c24cb0cbc214f4f6197b284eed8bcb5d0e25daa88f6905e88271c

See more details on using hashes here.

File details

Details for the file hash_calculation-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: hash_calculation-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 7.7 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b063d25cfc8b4f0e81097ccc70eafad4a4b1458ccf21134942a5e3cf23ab344b
MD5 c42cb04ef05ee0d8478700a506f71bf3
BLAKE2b-256 2eacbc759b7987e1da398302d7e7e853025f1c6b74d1837f11a8510ed4cdf611

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