PROTOTYPE

This commit is contained in:
2026-10-02 13:27:22 -04:00
parent 1e5fba618d
commit 0ca0255385
6 changed files with 27 additions and 6 deletions

View File

@@ -1,22 +1,19 @@
import hashlib
import os
# Anchor hashes.txt relative to the libs folder
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
HASH_LIST_PATH = os.path.join(
BASE_DIR, "hashes.txt"
) # or os.path.join(BASE_DIR, "..", "hashes.txt")
)
def hashcheck(fileToCheck):
# Remove trailing spaces or wrapped quotes from drag-and-drop
clean_path = str(fileToCheck).strip().strip('"').strip("'")
if not os.path.isfile(clean_path):
print(f"Error: Path does not exist or is a directory: {clean_path}")
return False
# Read file in binary mode and compute hash
with open(clean_path, "rb") as f:
digest = hashlib.file_digest(f, "sha256")
file_hash = digest.hexdigest()