src/main/java/org/jivesoftware/whack/util/StringUtils.java
public synchronized static final String hash(String data) {
        if (digest == null) {
            try {
                digest = MessageDigest.getInstance("SHA-1");
            } catch (NoSuchAlgorithmException nsae) {
                System.err.println("Failed to load the SHA-1 MessageDigest. "
                        + "Jive will be unable to function normally.");
            }
        }
        // Now, compute hash.
        try {
            digest.update(data.getBytes("UTF-8"));
        } catch (UnsupportedEncodingException e) {
            System.err.println(e);
        }
        return encodeHex(digest.digest());
    }
public synchronized static final String hash(String data) {
        if (digest == null) {
            try {
                digest = MessageDigest.getInstance("SHA-1");
            } catch (NoSuchAlgorithmException nsae) {
                System.err.println("Failed to load the SHA-1 MessageDigest. "
                        + "Jive will be unable to function normally.");
            }
        }
        // Now, compute hash.
        try {
            digest.update(data.getBytes("UTF-8"));
        } catch (UnsupportedEncodingException e) {
            System.err.println(e);
        }
        return encodeHex(digest.digest());
    }
Hashes a String using the SHA-1 algorithm and returns the result as a
String of hexadecimal numbers. This method is synchronized to avoid
excessive MessageDigest object creation. If calling this method becomes a
bottleneck in your code, you may wish to maintain a pool of MessageDigest
objects instead of using this method.
<p>
A hash is a one-way function -- that is, given an input, an output is
easily computed. However, given the output, the input is almost
impossible to compute. This is useful for passwords since we can store
the hash and a hacker will then have a very hard time determining the
original password.

@param data
the String to compute the hash of.
@return a hashed version of the passed-in String