Last active
August 29, 2015 14:03
-
-
Save laughingman7743/afa557696632d1ae248e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static String generateSHA1(String str) { | |
| String digestStr = null; | |
| try { | |
| MessageDigest digest = MessageDigest.getInstance("SHA"); | |
| digest.update(str.getBytes()); | |
| digestStr = new String(Hex.encodeHex(digest.digest())); | |
| } catch (NoSuchAlgorithmException e) { | |
| Logger.error("Unknown algorithm.", e); | |
| } | |
| return digestStr; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment