quivr/streamlit-demo/utils.py

12 lines
326 B
Python
Raw Normal View History

2023-05-13 00:05:31 +03:00
import hashlib
def compute_sha1_from_file(file_path):
with open(file_path, "rb") as file:
bytes = file.read()
readable_hash = compute_sha1_from_content(bytes)
2023-05-13 00:05:31 +03:00
return readable_hash
def compute_sha1_from_content(content):
readable_hash = hashlib.sha1(content).hexdigest()
return readable_hash