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
  [FREE] Database Searcher Telegram odanbtw 1,020 86,461 2 hours ago
Last Post: Netr0
  ✅ Top 10 Google Dorks For SQL Injections NextSoftGroup 12 427 Yesterday, 01:54 PM
Last Post: V1nh
  Amex 5.07.2024 SCAMPAGE WITH ADMIN PANEL xls 15 1,901 Yesterday, 10:04 AM
Last Post: Isolatedforsex
  Bypassing Modern AV (Metasploit Method) godco99 8 478 May 05, 2026, 07:54 PM
Last Post: manguberdi
  ✨ [TUTORIAL] MAKE A PHISHING PAGE⚡STEAL LOGIN CREDENTIALS FROM ANY WEBSITE ✨ MINDHUNTER 274 19,608 May 05, 2026, 06:20 PM
Last Post: pddemerde

Forum Jump:


 Users browsing this forum: 1 Guest(s)