Skip to content

Instantly share code, notes, and snippets.

@sw17ch
Last active May 3, 2016 19:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sw17ch/226a2359d06ecd3e34574dcb21867469 to your computer and use it in GitHub Desktop.
Save sw17ch/226a2359d06ecd3e34574dcb21867469 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import sys
import os
import hashlib
ALIGN = 256
for f in sys.argv[1:]:
if os.path.isfile(f):
data = open(f,'r').read()
sha256 = hashlib.sha256()
sha256.update(data)
over_boundary = len(data) % ALIGN
if 0 < over_boundary:
required = ALIGN - over_boundary
sha256.update('\xFF' * required)
print("%s\t%s" % (sha256.hexdigest(), f))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment