Answer the question
In order to leave comments, you need to log in
How to do dropdown with login/password pair and pass password through crypted?
Hello!
There is a form like:
<input id="login">
<input id="pass" type="password">
var algorithm = 'aes192', password = '1234';
function encrypt(text){
var cipher = crypt.createCipher(algorithm, password)
var crypted = cipher.update(text,'utf8','hex')
crypted += cipher.final('hex');
return crypted;
}
function decrypt(text){
var decipher = crypt.createDecipher(algorithm, password)
var dec = decipher.update(text,'hex','utf8')
dec += decipher.final('utf8');
return dec;
}
new Builder($("login")).on("oninput", function(){
window.localStorage['login'] = encrypt(this.value);
}).on("onblur", updateProfile);
new Builder($("pass")).on("oninput", function(){
window.localStorage['pass'] = encrypt(this.value);
}).on("onblur", updateProfile);
$("login").value = window.localStorage['login'] ? decrypt(window.localStorage['login']) : "";
$("pass").value = window.localStorage['pass'] ? decrypt(window.localStorage['pass']) : "";
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question