scr/duplicate_check.py

20 lines
394 B
Python
Raw Normal View History

#!/usr/bin/env python
2025-06-25 21:28:54 +00:00
# Duplicate Check
# Version: 0.9.0
2025-06-25 21:28:54 +00:00
2025-06-25 21:30:25 +00:00
# Copyright 2025 Jake Winters
2025-06-25 21:36:04 +00:00
# SPDX-License-Identifier: BSD-3-Clause
import os
2025-06-25 21:37:13 +00:00
import hashlib
def hash_file(file_path):
sha256_hash = hashlib.sha256()
with open(file_path, 'rb') as f:
for byte_block in iter(lambda: f.read(65536), b''):
sha256_hash.update(byte_block)
return sha256_hash.hexdigest()