title: Hashing a password before form submission on Server
body: <p>Below function use in JavaScript(<strong>forms.js</strong> include) for hashing a password.
  Whats is the equivalent in JAVA,</p>
  
  <pre><code>function formhash(form, password) {
        console.log("Hashing form");
        // Create a new element input, this will be our hashed password field.
        var p = document.createElement("input");
        // Add the new element to our form.
        form.appendChild(p);
        p.name = "p";
        p.type = "hidden"
        p.value = hex_sha512(password.value);
        // Make sure the plaintext password doesn't get sent.
        password.value = "";
        // Finally submit the form.
        form.submit();
      }
  </code></pre>