Created
October 30, 2019 11:06
-
-
Save giasuddin90/f608ed148952eb9f376a73c2e316b1d9 to your computer and use it in GitHub Desktop.
python password encryption by salt. some time we need encryption for password or other thin for your software then we can use hashlb and shah512 for encryption. Encryption is needed for security, you have lot of option to encryption your password, i am just giving simple way to encryption password.
This file contains hidden or 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
__author__ = 'giasuddin' | |
import hashlib | |
''' | |
some time we need encryption for password or other thin for your software then we can use hashlb and shah512 for encryption. | |
Encryption is needed for security, you have lot of option to encryption your password, i am just giving simple way to encryption password. | |
''' | |
def password_encyption(password): | |
""" | |
Python password encryption by using | |
:param password: | |
:return: | |
""" | |
salt = 'test123' | |
encode_salt = salt.encode() | |
str_pass = str(password) | |
encode_password = str_pass.encode() | |
hash_object = hashlib.sha512() | |
hash_object.update(encode_password+encode_salt) | |
hex_dig = hash_object.hexdigest() | |
return hex_dig | |
if __name__ == '__main__': | |
test=password_encyption("456") | |
print(test) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment