X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=lttng_ivc%2Futils%2Futils.py;fp=lttng_ivc%2Futils%2Futils.py;h=23ce4bce20ae3d2700d0bb57ace4d1cf5cbb7dcb;hb=cb87ff891c9968115d151a54e93695da0ac4df02;hp=aedb1fdb3c0ae62a0dd68ee531d608fbfaff3fa2;hpb=494bd6b94202022e56b3615636966cf51230bb75;p=deliverable%2Flttng-ivc.git diff --git a/lttng_ivc/utils/utils.py b/lttng_ivc/utils/utils.py index aedb1fd..23ce4bc 100644 --- a/lttng_ivc/utils/utils.py +++ b/lttng_ivc/utils/utils.py @@ -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