Skip to content

Instantly share code, notes, and snippets.

@erichsu
Created October 10, 2015 03:26
Show Gist options
  • Save erichsu/a7f4a34acf92924db2dc to your computer and use it in GitHub Desktop.
Save erichsu/a7f4a34acf92924db2dc to your computer and use it in GitHub Desktop.
private String md5(String input) {
String md5 = null;
try {
MessageDigest digest = MessageDigest.getInstance("MD5");
digest.update(input.getBytes(), 0, input.length());
md5 = new BigInteger(1, digest.digest()).toString(16);
} catch (NoSuchAlgorithmException e) {
Timber.e(e.getLocalizedMessage(), e);
}
return md5;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment