Checksum the project.py file to validate that the pickle we get from the project...
[deliverable/lttng-ivc.git] / lttng_ivc / utils / utils.py
index aedb1fdb3c0ae62a0dd68ee531d608fbfaff3fa2..23ce4bce20ae3d2700d0bb57ace4d1cf5cbb7dcb 100644 (file)
@@ -1,4 +1,5 @@
 import signal
+import hashlib
 
 def line_count(file_path):
     line_count = 0
@@ -8,6 +9,14 @@ def line_count(file_path):
     return line_count
 
 
+def sha256_checksum(filename, block_size=65536):
+    sha256 = hashlib.sha256()
+    with open(filename, 'rb') as f:
+        for block in iter(lambda: f.read(block_size), b''):
+            sha256.update(block)
+    return sha256.hexdigest()
+
+
 def __dummy_sigusr1_handler():
     pass
 
This page took 0.023272 seconds and 5 git commands to generate.