Skip to content

Instantly share code, notes, and snippets.

@insom
Created July 7, 2011 12:22
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 insom/1069395 to your computer and use it in GitHub Desktop.
Save insom/1069395 to your computer and use it in GitHub Desktop.
Consistent Password Hashing, for Developers
#!/usr/bin/python
import hashlib
import sys
def main(key, username, hostname):
m = hashlib.md5('%s%s%s' % (key, username, hostname))
h = m.hexdigest()
f8 = h[:8]
print f8
if __name__ == '__main__':
main(*sys.argv[1:])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment