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 😉

Unique opportunity! Help a fellow grow his blog!

Hi there! If you’ve read this far maybe you think this was useful, or fun, or I don’t know what but for some reason You Got Here! Great! Please consider sharing this post with your network, I am trying to get The Code Butchery to grow so I can provide more content like this, will you help me in my journey? Thank you!

Share this

Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.