+ 6
When making a password protected site how do you hide the password in your code so that people reading your code do not see it
Hiding your password
12 Réponses
+ 5
In what scenario would you include a password in code that is accessible to people?
+ 4
👍
+ 4
Thx
+ 4
Hiding the password in the code
+ 4
If you look at my codes its called password .2
+ 3
Okay... I understand. This is for a simple exercise in Code Playground and nothing for a real world application.
One option to consider is a one way hash script. Use this one way hash script to hash the password you plan to store in your code.
So... Instead of using:
const pasword = "123";
You would store the hash value:
const hashedPassword = "202cb962ac59075b964b07152d234b70"
This hash was generated using the following link:
https://blueimp.github.io/JavaScript-MD5/
Next, the script used to create this hash would need to be in your code. This will be used to hash the user input password before comparing with the password in the code.
Example:
if( hashedPassword == hashThis(txtPassword) ) { ... }
I hope this helps.
+ 1
donykage Boss I'd further clarify that POST over SSL and GET with Request Body over SSL are the preferred methods for submitting sensitive data.
However, this is for submitting data, not hiding passwords in code.
Abraham Are you asking about submitting passwords or hiding passwords in code?
+ 1
You want the password to be encrypted, usually no reason to add password directly
0
You want to encrypt your password so even if people see the encrypted password they can't do anything with it :)
0
On one of our old company ftp servers we had a passwords.txt with plaintext passwords of every user just chilling on the desktop. :D
0
consider the method in your form, method=“post”, this will hide ur code. place encryption method in your dbase
0
Abraham Can you explain the scenario where you would have passwords in code?