Skip to content

Instantly share code, notes, and snippets.

@stephnr
Last active August 29, 2015 14:05
Show Gist options
  • Save stephnr/9103424adf8566b63c39 to your computer and use it in GitHub Desktop.
Save stephnr/9103424adf8566b63c39 to your computer and use it in GitHub Desktop.
Python Password Encryption using Passlib -- https://pythonhosted.org/passlib/index.html
from passlib.hash import sha256_crypt
# Create Encrypted Password
hash = sha256_crypt.encrypt("super_secret_password")
# Verify Encrypted Password
sha256_crypt.verify("super_secret_password", hash)
# Create Encrypted Password
hash = md5_crypt.encrypt("super_secret_password")
# Verify Encrypted Password
md5_crypt.verify("super_secret_password", hash)
// Generate random password
Math.random().toString(36).substr(2,7); // return some of "kj8c7t0"
# Create Encrypted Password
hash = sha512_crypt.encrypt("super_secret_password")
# Verify Encrypted Password
sha512_crypt.verify("super_secret_password", hash)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment