0

Hi, using a snippet I found on here I have this code:

var password;
var pass1="PASSWORD-HERE";
password=prompt('Whats The Magic Word?',' ');
if (password==pass1) alert('That Is Correct!');
else {
  window.location="SITE-LINK";
}

But I want to make pass1 harder to see so I want to encrypt it and use that as the var. Then I want to decrypt it at the if so that it is harder to be used to access secure information. How would I go about doing this?

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by HenryGR
0

Hi, using a snippet I found on here I have this code:

var password;
var pass1="PASSWORD-HERE";
password=prompt('Whats The Magic Word?',' ');
if (password==pass1) alert('That Is Correct!');
else {
  window.location="SITE-LINK";
}

But I want to make pass1 harder to see so I want to encrypt it and use that as the var. Then I want to decrypt it at the if so that it is harder to be used to access secure information. How would I go about doing this?

Well, on a first place, I would never try to use Javascript for a password protected business, but if you have to, create the code and, once finished, try to obfuscate the whole, instead of a single variable.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.