How to get the SHA1 hash sum of a String in Android

Here’s one piece of code that comes very handy in some situations, just copy and paste this to get the SHA1 hash sum from a text String. The Hash is returned as an hex encoded human readable String, see below for an example of use:

Here’s how to use this:

The code above will print this output:

String: Hello World
SHA1 HASH: 0a4d55a8d778e5022fab701977c5d840bbc486d0

Enjoy 😉