Nicer output for binsum.py.

This commit is contained in:
2018-10-18 00:55:12 +02:00
parent 818f63a658
commit 121522ced7
3 changed files with 20 additions and 4 deletions
+10 -2
View File
@@ -52,5 +52,13 @@ with open(FILE, "rb") as f:
if len(block) < BLOCKSIZE:
break
f.close()
print("Calculated SHA1: {}".format(csum.hexdigest()))
print("SHA1 in file : {} (offset 0x{:x})".format(trailer[:20].hex(), trailer_pos))
expected_sha1 = csum.hexdigest()
found_sha1 = trailer[:20].hex()
print("Calculated SHA1: {}".format(expected_sha1))
print("SHA1 in file : {} (offset 0x{:x})".format(found_sha1, trailer_pos))
if expected_sha1 == found_sha1:
print("☑ CHECKSUM VALID.")
else:
print("☒ CHECKSUM INVALID!!! (Or GCD or other type.)")