Skip to content

Instantly share code, notes, and snippets.

@SEJeff
Created August 15, 2014 09:01
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 SEJeff/d5fee36d8dd6b015a2ee to your computer and use it in GitHub Desktop.
Save SEJeff/d5fee36d8dd6b015a2ee to your computer and use it in GitHub Desktop.
Hexdigest on python 2.6 and 2.7
############################################################################################
>>> sys.version
'2.7.3 (default, Aug 9 2012, 17:23:57) \n[GCC 4.7.1 20120720 (Red Hat 4.7.1-5)]'
>>> for algo in hashlib.algorithms:
... print '{algo} has hexdigest()'.format(instance=getattr(hashlib, algo)(), algo=algo)
...
md5 has hexdigest()
sha1 has hexdigest()
sha224 has hexdigest()
sha256 has hexdigest()
sha384 has hexdigest()
sha512 has hexdigest()
############################################################################################
>>> sys.version
'2.6.5 (r265:79063, Oct 1 2012, 22:04:36) \n[GCC 4.4.3]'
>>> for algo in ('md5', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512'):
... print '{algo} has hexdigest()'.format(instance=getattr(hashlib, algo)(), algo=algo)
...
md5 has hexdigest()
sha1 has hexdigest()
sha224 has hexdigest()
sha256 has hexdigest()
sha384 has hexdigest()
sha512 has hexdigest()
############################################################################################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment