write wrapper hash method

This commit is contained in:
Justus Kuhlmann 2025-11-21 11:53:25 +01:00
commit a080ca835f
Signed by: jkuhl
GPG key ID: 00ED992DD79B85A6

View file

@ -1,5 +1,5 @@
import hashlib
import os
def str2list(string): def str2list(string):
return string.split(",") return string.split(",")
@ -22,3 +22,10 @@ def record2name_key(record_path: str):
file = record_path.split("::")[0] file = record_path.split("::")[0]
key = record_path.split("::")[1] key = record_path.split("::")[1]
return file, key 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