Created
March 31, 2017 17:35
-
-
Save king6cong/5e5407d66b037c0e00d52f870095bae5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hashlib | |
def hash_passwd(passwd, salt): | |
return 'sha256$' + hashlib.sha256(passwd + salt).hexdigest() | |
SALT = "this is a secret and do not share with others" | |
# use case: | |
passwd = "this is an example passwd" | |
passwd_hash = hash_passwd(passwd, SALT) | |
print(passwd_hash) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment