Java 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

StringMd5Encode(String source)
Encode a string using MD5 method
MessageDigest md;
String result = "";
try {
    md = MessageDigest.getInstance("MD5");
    md.update(source.getBytes());
    byte byteData[] = md.digest();
    StringBuffer sb = new StringBuffer();
    for (int i = 0; i < byteData.length; i++) {
...
Stringmd5Encode(String source)
Get MD5 Encoding
try {
    MessageDigest md = MessageDigest.getInstance("MD5");
    byte[] bytes = md.digest(source.getBytes("UTF-8"));
    return getHexString(bytes);
} catch (Exception e) {
    e.printStackTrace();
    return null;
StringMD5Encode(String sourceString)
MD Encode
String resultString = null;
try {
    resultString = new String(sourceString);
    MessageDigest md = MessageDigest.getInstance("MD5");
    resultString = byte2hexString(md.digest(resultString.getBytes()));
} catch (Exception ex) {
return resultString;
...
Stringmd5Encode(String src)
md Encode
MessageDigest md = null;
try {
    md = MessageDigest.getInstance("MD5");
    md.update(src.getBytes(UTF_8));
} catch (NoSuchAlgorithmException e) {
    e.printStackTrace();
} catch (UnsupportedEncodingException e) {
    e.printStackTrace();
...
StringMD5Encode(String str)
Make an MD5 Hash from a particular string.
String returnVal = null;
try {
    MessageDigest md = MessageDigest.getInstance("MD5");
    byte mdArr[] = md.digest(str.getBytes("UTF-16"));
    returnVal = toHexString(mdArr);
} catch (Exception e) {
    returnVal = URLEncoder.encode(str, "UTF-8").replaceAll("\\*", "x");
return returnVal;
Stringmd5Encode(String strPlain)
md Encode
byte[] s = md5(strPlain);
StringBuilder result = new StringBuilder();
for (int i = 0; i < s.length; i++) {
    result.append(Integer.toHexString((0x000000ff & s[i]) | 0xffffff00).substring(6));
return result.toString();
StringMD5Encoder(String s, String charset)
MD Encoder
try {
    byte[] btInput = s.getBytes(charset);
    MessageDigest mdInst = MessageDigest.getInstance("MD5");
    mdInst.update(btInput);
    byte[] md = mdInst.digest();
    StringBuffer sb = new StringBuffer();
    for (int i = 0; i < md.length; i++) {
        int val = ((int) md[i]) & 0xff;
...
Stringmd5encoding(String data)
Hashes a String using the Md5 algorithm and returns the result as a String of hexadecimal numbers.
if (digest == null) {
    try {
        digest = MessageDigest.getInstance("MD5");
    } catch (NoSuchAlgorithmException nsae) {
        nsae.printStackTrace();
digest.update(data.getBytes());
...
Stringmd5Encoding(String s)
Returns MD5-tarkistussumman merkkijonosta.
if (s == null) {
    return null;
MessageDigest md = null;
try {
    md = MessageDigest.getInstance("MD5");
} catch (java.security.NoSuchAlgorithmException ex) {
    throw new AssertionError(ex);
...
StringMD5Encoding(String source)
MD Encoding
MessageDigest mdInst = MessageDigest.getInstance("MD5");
byte[] input = source.getBytes();
mdInst.update(input);
byte[] output = mdInst.digest();
int i = 0;
StringBuffer buf = new StringBuffer("");
for (int offset = 0; offset < output.length; offset++) {
    i = output[offset];
...