Guest User

Untitled

a guest
Jan 22nd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.37 KB | None | 0 0
  1. public String MD5( String str )
  2. {
  3.     MessageDigest md;
  4.     try
  5.     {
  6.         md = MessageDigest.getInstance( "MD5" );
  7.         md.reset();
  8.         md.update( str.getBytes( "UTF-8" ) );
  9.         byte[] digest = md.digest();
  10.        
  11.         BigInteger bigInt = new BigInteger( 1, digest );
  12.         String hashtext = bigInt.toString( 16 );
  13.        
  14.         return hashtext;
  15.     } catch ( Exception e )
  16.     {
  17.         return null;
  18.     }
  19. }
Add Comment
Please, Sign In to add comment