Share your repls and programming experiences

← Back to all posts
Python Hash Encode
Coder100 (17038)

Do you want to encode passwords and other sensitive information on python?

Obviously, the easiest way is to use hash encryption where the encryption method is so complex it is a one-way street where you can only encrypt something, not decrypt something.

The special thing about hash encryption is that the encryption method is constant, meaning if "Joe" encrypted to "8j493fh", it will always encrypt to "8j493fh". Which is very useful if you think about it. The client who knows the password can authenticate, but the hacker must brute force their way in.

So, anyway, I have found a great javascript function, but how to turn it into python? Here comes my project! I have converted it into python, and my earlier self, with less experience with python, converted it so it only had numbers and dashes ("Joe" encrypted to "324987-1324798-38490"). That's not very good, so I remade it and now it can encrypt with letters too! ("Joe" encrypts to "fj4389fjiof-fejfifj943")

hash(text to be encrypted,options)
text to be encrypted: Well, the text you want to encrypt, duh
options: Leave blank for 2.
1. Number encryption ("Joe" encrypted to "324987-1324798-38490")
2. Letter encryption ("Joe" encrypts to "fj4389fjiof-fejfifj943")



Right now, it supports all the characters of the American alphabet. I don't know why 我会说中文 doesn't encrypt, but I am open to suggestions!
EDIT: All the characters now encrypt, except for the ones that don’t, like shown below:

print(hash('Why don't this work!'))

Have fun with undecodable databases hackers can't access!

Please enjoy my hard work and give this post an upvote!

Here's the code so you can help the development of the project: