From c90a0561d41c49bd7212d5dc9b8891d5c97378fd Mon Sep 17 00:00:00 2001 From: "Antonio J. Delgado" Date: Wed, 25 Jan 2023 14:49:51 +0200 Subject: [PATCH] read bytes --- find_duplicate_files/find_duplicate_files.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/find_duplicate_files/find_duplicate_files.py b/find_duplicate_files/find_duplicate_files.py index e6c4380..e1caa06 100644 --- a/find_duplicate_files/find_duplicate_files.py +++ b/find_duplicate_files/find_duplicate_files.py @@ -47,8 +47,9 @@ class find_duplicate_files: if file.is_file(): hash = hashlib.sha256() with open(file.path, 'rb') as file_pointer: - digest = hashlib.file_digest(file_pointer, "sha256") - files[digest.hexdigest()] = file.path + file_content = file_pointer.read() + hash.update(file_content.encode('utf-8')) + files[hash.hexdigest()] = file.path elif file.is_dir(follow_symlinks=False): more_files = self.recursive_scandir( file.path,