How to use hash function in java for hashing the password?
<p>I am trying to hash a password and save it in the database; I know hashing is a one way process. How can I check whether the user supplied password and the one stored in the database are same? I am using MD5 and I am getting different values for the same input when I perform hashing each time. Can anyone help?</p>

<pre><code>String pass = "wor1ldcup";
    String pass1 = "wor1ldcup";

    DigestUtils du = new DigestUtils();
    byte[] b = du.md5(pass);
    byte[] b1 = du.md5(pass1);
</code></pre>
