daily pastebin goal
27%
SHARE
TWEET

Untitled

a guest Jun 13th, 2018 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public static String criptografia(String original) throws UnsupportedEncodingException {
  2.         String senha = null;
  3.         MessageDigest algoritmo;
  4.         byte messageDigest[];
  5.         StringBuilder hexString;
  6.         try {
  7.  
  8.             algoritmo = MessageDigest.getInstance("MD5");  // 32 letras
  9.             messageDigest = algoritmo.digest(original.getBytes("UTF-8"));
  10.             hexString = new StringBuilder();
  11.             for (byte b : messageDigest) {
  12.                 hexString.append(String.format("%02X", 0xFF & b));
  13.             }
  14.             senha = hexString.toString();
  15.         } catch (NoSuchAlgorithmException e) {
  16.             e.printStackTrace();
  17.         } catch (UnsupportedEncodingException e) {
  18.             e.printStackTrace();
  19.         }
  20.         return senha;
  21.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top