Android MD5 Encode getMD5(byte[] source)

Here you can find the source of getMD5(byte[] source)

Description

get MD

Declaration

private static String getMD5(byte[] source) 

Method Source Code

//package com.java2s;

import java.security.MessageDigest;

public class Main {
    private static String getMD5(byte[] source) {
        try {//from  w  w  w . j a  v  a 2  s  .co  m
            MessageDigest md5 = MessageDigest.getInstance("MD5");
            StringBuffer result = new StringBuffer();
            for (byte b : md5.digest(source)) {
                result.append(Integer.toHexString((b & 0xf0) >>> 4));
                result.append(Integer.toHexString(b & 0x0f));
            }
            return result.toString();
        } catch (Exception e) {
            throw new RuntimeException(e.getMessage(), e);
        }
    }
}

Related

  1. MD5(String md5)
  2. getMD5Str(String str)
  3. MD5(String text)
  4. stringGetMD5String(String s)
  5. byteMd5(String plainText, Boolean is16)
  6. md5(String string)
  7. createHMACWithMD5(String source, String key)
  8. md5(String text)
  9. encryptByUsingMd5(String passwd)