Skip to content

Instantly share code, notes, and snippets.

@philipaconrad
Created December 26, 2014 06:47
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 philipaconrad/93166236ce69b3a20939 to your computer and use it in GitHub Desktop.
Save philipaconrad/93166236ce69b3a20939 to your computer and use it in GitHub Desktop.
Command line script that shows the MD5 checksum for a given file.
# md5.py -- Simple MD5 checksum tool in Python.
# By Philip Conrad on 2014-12-26. Public Domain.
import hashlib
import sys
if __name__ == '__main__':
try:
m = hashlib.md5()
text = open(sys.argv[1], "rb").read()
m.update(text)
print m.hexdigest()
except IndexError:
print "USAGE: python md5.py FILENAME\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment