Library providing various hash algorithms (MD5, SHA1, SHA256, etc) in Java?

Naftuli Kay picture Naftuli Kay · Jun 2, 2011 · Viewed 17.9k times · Source

Is there a simple library out there for Java in a Maven repository that will give me simple, one-liner hash methods for the popular hash functions such as MD5, SHA1, SHA256, and SHA512? I'd really hate to have to reinvent the wheel to do this.

Answer

Vineet Reynolds picture Vineet Reynolds · Jun 2, 2011

The DigestUtils class of Apache Commons Codec is suitable for the purpose of simplifying the use of the MessageDigest class, which appears to be what you are attempting to use in the first place.