Java calculate hex representation of a SHA-1 digest of a String

Using apache common codec library:

DigestUtils.sha1Hex("aff")

The result is 0c05aa56405c447e6678b7f3127febde5c3a9238

That’s it 🙂

Leave a Comment