Add SHA-256-based hashing for files and store the values in a dictionary for later use with the detection-and-deletion function.
20 lines
394 B
Python
20 lines
394 B
Python
#!/usr/bin/env python
|
|
|
|
# Duplicate Check
|
|
# Version: 0.9.0
|
|
|
|
# Copyright 2025 Jake Winters
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
|
|
import os
|
|
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()
|