title: Client side password encryption using md5.js and decryption in PHP
body: <p>I am using a form with <code>user</code> and <code>password</code> fields in that I need to encrypt the password before sending the form to the server for validation. For that I am using <code>md5.js</code> for encryption on client side using the salt information.</p>
  
  <p><code>test.php</code></p>
  
  <pre><code>&lt;script LANGUAGE="Javascript" SRC="js/md5.js"&gt;&lt;/script&gt;
  &lt;script&gt;
      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;
      }
  &lt;/script&gt;
  &lt;form method="post" action="test1.php"&gt;
      &lt;input type="hidden" 
             name="salt"
             id="salt"
             value="8qadr4xnCPW275BaNpYX"&gt;
      &lt;label class="login"&gt;Password:&lt;/label&gt;
      &lt;input
          name="password"
          id="password"
          type="password" /&gt;
      &lt;input type="submit"
          name="gos"
          id="gos"
          value="Login"
          onClick="return validateForm('8qadr4xnCPW275BaNpYX','38');"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>This is the form which contains the client encryption using JavaScript and <code>md5.js</code>. I can successfully encrypt the message and send it to <code>test1.php</code> in that <code>test1.php</code>. I don't know how to decrypt the text please help me.</p>