Skip to content

Instantly share code, notes, and snippets.

@ariten
ariten / hash.py
Last active October 31, 2024 13:14
Hashing a Directory with MD5 and SHA256 and outputs them in to a CSV, aim is to provide a snapshot of a directory at a moment in time.
import hashlib
import csv
import os
import datetime
def calcualte_hash(file_path):
hash_md5 = hashlib.md5()
hash_SHA256 = hashlib.sha256()
try:
with open(file_path, "rb") as f: