I am using a form with user
and password
fields in that I need to encrypt the password before sending the form to the server for validation. For that I am using md5.js
for encryption on client side using the salt information.
test.php
<script LANGUAGE="Javascript" SRC="js/md5.js"></script>
<script>
function encryptPwd1(strPwd, strSalt, strit) {
var strNewSalt = new String(strSalt);
if (strPwd == "" || strSalt == "")
{
return null;
}
var strEncPwd;
var strPwdHash = MD5(strPwd);
var strMerged = strNewSalt + strPwdHash;
var strMerged1 = MD5(strMerged);
return strMerged1;
}
function validateForm(strSalt, strit) {
var strEncPwd = new String(encryptPwd1(document.getElementById("password").value, strSalt, strit));
document.getElementById("password").value = strEncPwd;
document.login.submit();
return true;
}
</script>
<form method="post" action="test1.php">
<input type="hidden"
name="salt"
id="salt"
value="8qadr4xnCPW275BaNpYX">
<label class="login">Password:</label>
<input
name="password"
id="password"
type="password" />
<input type="submit"
name="gos"
id="gos"
value="Login"
onClick="return validateForm('8qadr4xnCPW275BaNpYX','38');">
</form>
This is the form which contains the client encryption using JavaScript and md5.js
. I can successfully encrypt the message and send it to test1.php
in that test1.php
. I don't know how to decrypt the text please help me.
".$s."
"; echo md5($p.$s); hashed value: 004aa3549f5a63c6e885b3b5ef986ba8 salt: 8qadr4xnCPW275BaNpYX and result : d1a799133948dd41bf344d08ab16a44c – VPR Jul 11 '14 at 01:25