Skip to content

Calculates MD5 and SHA256 hashes for a given file

License

Notifications You must be signed in to change notification settings

5f0ne/hash-calc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Calculates MD5 and SHA256 hashes for a given file

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages