RKP64 commited on
Commit
51c9f57
·
1 Parent(s): 0e1fbf7

Upload utils.py

Browse files
Files changed (1) hide show
  1. utils.py +11 -0
utils.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import hashlib
2
+
3
+ def compute_sha1_from_file(file_path):
4
+ with open(file_path, "rb") as file:
5
+ bytes = file.read()
6
+ readable_hash = compute_sha1_from_content(bytes)
7
+ return readable_hash
8
+
9
+ def compute_sha1_from_content(content):
10
+ readable_hash = hashlib.sha1(content).hexdigest()
11
+ return readable_hash