Skip to content

Instantly share code, notes, and snippets.

@kevinho
Forked from ikarius/md5.groovy
Created January 18, 2016 13:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevinho/a19ea890af85368b1849 to your computer and use it in GitHub Desktop.
Save kevinho/a19ea890af85368b1849 to your computer and use it in GitHub Desktop.
How to generate a MD5 hash in Groovy ...
def generateMD5(String s) {
MessageDigest digest = MessageDigest.getInstance("MD5")
digest.update(s.bytes);
new BigInteger(1, digest.digest()).toString(16).padLeft(32, '0')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment