Calculates MD5 and SHA256 hashes for a given file or bytes
Project description
Description
Calculates MD5 and SHA256 hashes for a given file
Installation
pip install hash_calc
Usage
From command line:
python -m hash_calc [-h] --path PATH
Option | Short | Type | Default | Description |
---|---|---|---|---|
--path | -p | String | - | Path of the file to be hashed |
Programmatically:
from hash_calc.HashCalc import HashCalc
# 1.) Hash a file
pathToFile = "/path/to/file/test.txt
hashCalc = HashCalc(pathToFile)
print(hashCalc.md5)
print(hashCalc.sha256)
# 2.) Hash bytes
h = HashCalc.fromBytes(b"\x01\x02\x03")
print(h.sha256)
print(h.md5)
Example
python -m hash_calc -p test.txt
Creates the follwing result:
##############################################################################################
Hash Calc by 5f0
Calculates MD5 and SHA256 hashes for a given file
Current working directory: /path/to/hash_calc
Investigated file: test.txt
MD5 Hash: 265e08df10ed62d756e5e0bb6fadd69c
SHA256 Hash: 1675aa3766017a42980e686132eff094ba789bc3dc44de3e53f2fb05a7a513ff
Datetime: 01/01/1970 10:20:30
##############################################################################################
Execution Time: 0.003022 sec
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
hash_calc-1.1.0.tar.gz
(3.6 kB
view details)
Built Distribution
File details
Details for the file hash_calc-1.1.0.tar.gz
.
File metadata
- Download URL: hash_calc-1.1.0.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c700027cb3a8b89414090ac497af9ac735dcb2ff2f7c3f8ea01f67e47008fca7 |
|
MD5 | 80038180c0bd114fb707eeed93b5fd57 |
|
BLAKE2b-256 | 20de9e822e8e099abd46d71fb251590c591ace069829757a2ae8dff62bd7aee7 |
File details
Details for the file hash_calc-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: hash_calc-1.1.0-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 146a237a36dac072614ca8c0dbce0de510ac78f5d4d7861932cab496d95353f3 |
|
MD5 | 1c3355f5ebb48bfb5d14f14271745081 |
|
BLAKE2b-256 | 1352aeb83cbc417d634de07eb54abcc169ac2333242547b527911c0f0ebe3bc2 |