Android MD5 Encode hexMD5(String input)

Here you can find the source of hexMD5(String input)

Description

hex MD

License

Open Source License

Declaration

public static String hexMD5(String input) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.security.MessageDigest;

public class Main {
    public static String hexMD5(String input) {
        MessageDigest digester;/* w  w w.  j  a  v  a 2  s . co m*/
        byte[] bInput;
        try {
            digester = MessageDigest.getInstance("MD5");
            bInput = input.getBytes("UTF-8");
        } catch (Exception notgonnahappen) { // NoSuchAlgorithmException|UnsupportedEncodingException
            throw new RuntimeException(notgonnahappen);
        }

        byte[] bOutput = digester.digest(bInput);
        StringBuilder hexOutputBuilder = new StringBuilder(
                bOutput.length * 2);
        for (byte b : bOutput) {
            hexOutputBuilder.append(Integer.toHexString((0xFF & b) | 0x100)
                    .substring(1, 3));
        }

        return hexOutputBuilder.toString();
    }
}

Related

  1. getMD5Code(String value)
  2. getMD5(String s)
  3. MD5(String s)
  4. md5(final String s)
  5. md5(final String s)
  6. getMD5(String str)
  7. getMD5Digest(String str)
  8. computeMd5Hash(byte[] in)
  9. MD5(String md5)