Skip to content

Instantly share code, notes, and snippets.

@kirang89
Created September 18, 2013 05:15
Show Gist options
  • Save kirang89/6604833 to your computer and use it in GitHub Desktop.
Save kirang89/6604833 to your computer and use it in GitHub Desktop.
Simple salting of a password using CSPRNG(Cryptographically Secure Pseudo-Random Number Generator)
import os
import hashlib
def secure_password(password):
#This ensures that no two passwords have the same hash
salt = os.urandom(10)
return hashlib.sha256(salt + password).hexdigest()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment