Created
April 26, 2014 02:55
-
-
Save mithrandi/11310604 to your computer and use it in GitHub Desktop.
Quick sha256sum implementation in Python
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 | |
for fn in argv[1:]: | |
if fn == '-': | |
f = sys.stdin | |
else: | |
f = open(fn, 'rb') | |
with f: | |
print '%s *%s' % (sha256(f.read()).hexdigest(), fn) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Missing import of
sys.stdin
.