Skip to content

Instantly share code, notes, and snippets.

@mithrandi
Created April 26, 2014 02:55
Show Gist options
  • Save mithrandi/11310604 to your computer and use it in GitHub Desktop.
Save mithrandi/11310604 to your computer and use it in GitHub Desktop.
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