Created
April 20, 2012 22:36
-
-
Save alfg/2432357 to your computer and use it in GitHub Desktop.
Simple script to get both MD5 and SHA1 hash of any file.
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
#!/usr/bin/env python | |
# Simple script to get both MD5 and SHA1 hash of any file. | |
import sys | |
import hashlib | |
if len(sys.argv) < 2: | |
sys.exit('Usage: %s filename' % sys.argv[0]) | |
stream = sys.argv[1] | |
file = open(stream, "rb").read() | |
md5 = "MD5: " + hashlib.md5(file).hexdigest() | |
sha1 = "SHA1: " + hashlib.sha1(file).hexdigest() | |
print md5 | |
print sha1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment