Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Quick sha256sum implementation in Python
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)
@conqp
Copy link

conqp commented Apr 11, 2018

Missing import of sys.stdin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment