From a080ca835f7d22299bb7c21b6d9dea710549aaf3 Mon Sep 17 00:00:00 2001 From: Justus Kuhlmann Date: Fri, 21 Nov 2025 11:53:25 +0100 Subject: [PATCH] write wrapper hash method --- corrlib/tools.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/corrlib/tools.py b/corrlib/tools.py index 44697cc..70eb518 100644 --- a/corrlib/tools.py +++ b/corrlib/tools.py @@ -1,5 +1,5 @@ - - +import hashlib +import os def str2list(string): return string.split(",") @@ -21,4 +21,11 @@ def k2m(k): def record2name_key(record_path: str): file = record_path.split("::")[0] key = record_path.split("::")[1] - return file, key \ No newline at end of file + return file, key + + +def make_version_hash(path, record): + file, key = record2name_key(record) + with open(os.path.join(path, file), 'rb') as fp: + file_hash = hashlib.file_digest(fp, 'sha1').hexdigest() + return file_hash