Created
October 21, 2017 23:50
-
-
Save spalladino/5badbe88025d3d60c8470661c140ea5d to your computer and use it in GitHub Desktop.
Solution for Coursera Cryptography 1 course Week 3 programming assignment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from hashlib import sha256 | |
from sys import argv | |
with open(argv[1], "rb") as f: | |
blocks = [] | |
block = f.read(1024) | |
while block: | |
blocks.append(block) | |
block = f.read(1024) | |
h = sha256(blocks[-1]) | |
for block in reversed(blocks[:-1]): | |
h = sha256(block + h.digest()) | |
print(h.hexdigest()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment