Why do the values of my hashes never match in Java?
<p>I have a <code>.jsp</code> which accepts password input.  It will not match the hash of a password inside the application, even though a test using <code>attempt.equals(password)</code> works prior to the hashing.</p>

<p>I am passing the string thus:</p>

<pre><code>PasswordManager.checkPassword(request.getParameter("password"))
</code></pre>

<p>This is my hashing code:</p>

<pre><code>byte[] password = p.getBytes("UTF-8");
byte[] attempt = a.getBytes("UTF-8");

passwordHash = DigestUtils.md5(password);
attemptHash = DigestUtils.md5(attempt);
</code></pre>

<p>In addition, I have set the encoding in the <code>.jsp</code>:</p>

<pre><code>&lt;fmt:requestEncoding value="UTF-8" /&gt;
</code></pre>

<p>However, the hashes remain stubbornly different.  Any ideas?</p>
