Java Utililty Methods MD5 Byte Array

List of utility methods to do MD5 Byte Array

Description

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

Method

byte[]md5(byte[] param)
md
try {
    MessageDigest md5 = MessageDigest.getInstance("MD5");
    return md5.digest(param);
} catch (Exception e) {
    e.printStackTrace();
return null;
StringMD5(byte[] source)
MD
String s = null;
char[] hexDigits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
try {
    MessageDigest md = MessageDigest.getInstance("MD5");
    md.update(source);
    byte[] tmp = md.digest();
    char[] str = new char[32];
    int k = 0;
...
Stringmd5(byte[] source)
md5 function
char hexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
java.security.MessageDigest md = java.security.MessageDigest.getInstance("MD5");
md.update(source);
byte tmp[] = md.digest();
char str[] = new char[32];
int k = 0;
for (int i = 0; i < 16; i++) {
    str[k++] = hexDigits[tmp[i] >>> 4 & 0xf];
...
Stringmd5(byte[] source)
digest message with MD5
try {
    MessageDigest md = MessageDigest.getInstance("MD5");
    md.update(source);
    byte tmp[] = md.digest();
    char str[] = new char[32];
    int k = 0;
    for (byte b : tmp) {
        str[k++] = hexDigits[b >>> 4 & 0xf];
...
Stringmd5(byte[] source)
md
try {
    MessageDigest messageDigest = MessageDigest.getInstance(ALGORITHM);
    messageDigest.update(source);
    byte[] digest = messageDigest.digest();
    int j = digest.length;
    char str[] = new char[j * 2];
    int k = 0;
    for (int i = 0; i < j; i++) {
...
StringMD5(byte[] src)
MD
try {
    MessageDigest crypt = MessageDigest.getInstance("MD5");
    crypt.reset();
    crypt.update(src);
    return ToHex(crypt.digest());
} catch (NoSuchAlgorithmException e) {
    e.printStackTrace();
return null;
byte[]md5(byte[] str)
md
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(str);
return md.digest();
Stringmd5(final byte[] b)
md
final StringBuilder sb = new StringBuilder();
for (final byte element : b) {
    int i = element;
    if (i < 0) {
        i += 256;
    if (i < 16) {
        sb.append('0');
...
byte[]md5(final byte[] bytes)
Gets the given byte array's MD5 checksum, or null if unavailable.
return digest("MD5", bytes);
Stringmd5(final byte[] data)
Returns the MD5 of the specified bytes
if (null == data || data.length <= 0) {
    throw new IllegalArgumentException("empty data");
try {
    final MessageDigest md = MessageDigest.getInstance("MD5");
    return toHexString(md.digest(data));
} catch (final NoSuchAlgorithmException e) {
    return null;
...