Free Python script to check hash
by QUBIT_MATRIX - Saturday August 31, 2024 at 12:43 AM
#1
import sys, hashlib

# function to get hash of a file
def get_hash(file_path):
    # create a hash object
    h = hashlib.sha256()
    # open file for reading in binary mode
    with open(file_path, 'rb') as file:
        # loop till the end of the file
        chunk = 0
        while chunk != b'':
            # read only 1024 bytes at a time
            chunk = file.read(1024)
            h.update(chunk)
    # return the hex representation of the digest
    return h.hexdigest()

# read parameter from command line
file_path = sys.argv[1]
# print the hash of the file
print(get_hash(file_path))

Save as hash.py.
Usage example: hash.py software.exe
Output example: 9caf72e26bf50ba8f677b96d2b804860be51eb7d6753546a9a13a70b97a332e1

Feel free to refactor.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  STOP PAYING FOR CAPTCHA SERVICES!!! UNLIMITED CAPTCHA SOLVER TUTORIAL HASBULLA 86 14,054 1 hour ago
Last Post: pablouhq
  WormGPT? D3N1S 258 41,114 2 hours ago
Last Post: ibrfrefkawijr
  DarkGPT Tutorial Easy idontknowmyname 187 7,975 7 hours ago
Last Post: Breacher_Lokidas
  0day-Mari Bot Godfather1 77 7,224 11 hours ago
Last Post: Diezxx
  [2026] Bypass AV / EDR Spearr 63 1,235 Yesterday, 07:19 PM
Last Post: AKASHIC

Forum Jump:


 Users browsing this forum: 1 Guest(s)