From c1d6b0b37c8727a164f0e4cd8a1f241809a67132 Mon Sep 17 00:00:00 2001 From: ddc Date: Mon, 10 Aug 2020 15:44:14 -0300 Subject: [PATCH] update --- src/main_src.py | 2 +- src/utils/utilities.py | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/main_src.py b/src/main_src.py index 110115b..b1f64f6 100644 --- a/src/main_src.py +++ b/src/main_src.py @@ -701,7 +701,7 @@ def _update_arcdps(self): self.qtObj.main_tabWidget.setCurrentIndex(2) return False - current_d3d9_md5 = utilities.md5Checksum(d3d9_path) + current_d3d9_md5 = utilities.md5_checksum(d3d9_path) if req_d3d9_md5 != current_d3d9_md5: utilities.backup_arcdps_files(self, "backup") diff --git a/src/utils/utilities.py b/src/utils/utilities.py index 5e8accb..49d4368 100644 --- a/src/utils/utilities.py +++ b/src/utils/utilities.py @@ -154,15 +154,20 @@ def dialog_get_file_path(): ################################################################################ -def md5Checksum(filePath): - with open(filePath, 'rb') as fh: - m = hashlib.md5() +def md5_checksum(file_path): + BUF_SIZE = 8192 + md5 = hashlib.md5() + # sha1 = hashlib.sha1() + + with open(file_path, 'rb') as f: while True: - data = fh.read(8192) + data = f.read(BUF_SIZE) if not data: break - m.update(data) - return m.hexdigest() + md5.update(data) + # sha1.update(data) + # return sha1.hexdigest() + return md5.hexdigest() ################################################################################