Skip to content

Instantly share code, notes, and snippets.

@geraintwhite
Created March 24, 2015 16:16
Show Gist options
  • Save geraintwhite/e057c32cc1896fa5fbdb to your computer and use it in GitHub Desktop.
Save geraintwhite/e057c32cc1896fa5fbdb to your computer and use it in GitHub Desktop.
import sys
import hashlib
try:
check = sys.argv[1]
except IndexError:
check = None
with sys.stdin as f:
hash = hashlib.sha512(f.read().encode()).hexdigest()
print(hash == check if check else hash)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment