Android Utililty Methods MD5 Encode

List of utility methods to do MD5 Encode

Description

The list of methods to do MD5 Encode are organized into topic(s).

Method

byte[]getMD5(String s)
get MD
MessageDigest digest;
try {
    digest = java.security.MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
    throw new RuntimeException(e); 
digest.update(s.getBytes(Charset.forName("UTF-8")));
return digest.digest();
...
StringMD5(String s)
MD
try {
    byte[] btInput = s.getBytes();
    MessageDigest mdInst = MessageDigest.getInstance("MD5");
    mdInst.update(btInput);
    byte[] md = mdInst.digest();
    StringBuilder sBuilder = bytesToHexString(md);
    return sBuilder.toString();
} catch (Exception e) {
...
Stringmd5(final String s)
md
try {
    MessageDigest digest = MessageDigest.getInstance("MD5");
    digest.update(s.getBytes());
    byte messageDigest[] = digest.digest();
    StringBuffer hexString = new StringBuffer();
    for (int i = 0; i < messageDigest.length; i++) {
        String h = Integer.toHexString(0xFF & messageDigest[i]);
        while (h.length() < 2)
...
Stringmd5(final String s)
md
try {
    MessageDigest digest = java.security.MessageDigest
            .getInstance("MD5");
    digest.update(s.getBytes());
    byte messageDigest[] = digest.digest();
    StringBuffer hexString = new StringBuffer();
    for (int i = 0; i < messageDigest.length; i++) {
        String h = Integer.toHexString(0xFF & messageDigest[i]);
...
StringhexMD5(String input)
hex MD
MessageDigest digester;
byte[] bInput;
try {
    digester = MessageDigest.getInstance("MD5");
    bInput = input.getBytes("UTF-8");
} catch (Exception notgonnahappen) { 
    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();
StringgetMD5(String str)
get MD
if (str != null) {
    try {
        final BigInteger bigInt;
        if (sMD5Digest == null) {
            sMD5Digest = MessageDigest.getInstance("MD5");
        synchronized (sMD5Digest) {
            sMD5Digest.reset();
...
byte[]getMD5Digest(String str)
get MD Digest
if (str != null) {
    try {
        if (sMD5Digest == null) {
            sMD5Digest = MessageDigest.getInstance("MD5");
        synchronized (sMD5Digest) {
            sMD5Digest.reset();
            return sMD5Digest.digest(str.getBytes("UTF-8"));
...
byte[]computeMd5Hash(byte[] in)
Compute the MD5 hash of the byte array provided.
try {
    MessageDigest md5 = MessageDigest.getInstance("MD5");
    return md5.digest(in);
} catch (NoSuchAlgorithmException e) {
    throw new RuntimeException(e);
StringMD5(String md5)
MD
try {
    java.security.MessageDigest md = java.security.MessageDigest
            .getInstance("MD5");
    byte[] array = md.digest(md5.getBytes());
    StringBuilder sb = new StringBuilder();
    for (byte aByte : array) {
        sb.append(Integer.toHexString((aByte & 0xFF) | 0x100)
                .substring(1, 3));
...
byte[]MD5(String text)
MD
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(text.getBytes());
return md.digest();