-
-
Save davidbongcc/a231c82a38ac05ebc47c60f6156ae11d to your computer and use it in GitHub Desktop.
Solution for Coursera Cryptography 1 course Week 3 programming assignment
This file contains hidden or 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