Why is MessageDigest returning different answers for the same string?
<p>I am trying to get a hash value for a string using MessageDigest in Java, but the value is different every time. When I run the program twice it will again have completely different answers.</p>

<pre><code>        MessageDigest md = null;

        try {
            md = MessageDigest.getInstance("SHA-1");
        } catch (NoSuchAlgorithmException nsae) {
        }

        md.update("string".getBytes());
        byte[] digest = md.digest();
        System.out.println(digest);

        md.reset();

        md.update("string".getBytes());
        byte[] digest2 = md.digest();
        System.out.println(digest2);
</code></pre>
