Advertisement
Guest User

Untitled

a guest
Nov 10th, 2014
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.68 KB | None | 0 0
  1.     public static String decrypt(String str) {
  2.         if (str == null || str.length() == 0) {
  3.             throw new IllegalArgumentException("String to encript cannot be null or zero length");
  4.         }
  5.  
  6.         digester.update(str.getBytes());
  7.         byte[] hash = digester.digest();
  8.         StringBuffer hexString = new StringBuffer();
  9.         for (int i = 0; i < hash.length; i++) {
  10.             if ((0xff & hash[i]) < 0x10) {
  11.                 hexString.append("0" + Integer.toHexString((0xFF & hash[i])));
  12.             }
  13.             else {
  14.                 hexString.append(Integer.toHexString(0xFF & hash[i]));
  15.             }
  16.         }
  17.         return hexString.toString();
  18.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement