Java MD5 String MD5StringToL32(String md5Str)

Here you can find the source of MD5StringToL32(String md5Str)

Description

MD String To L

License

Open Source License

Declaration

public static String MD5StringToL32(String md5Str) 

Method Source Code

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

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class Main {
    public static String MD5StringToL32(String md5Str) {
        String string = null;/*w ww .j  a  v  a  2  s.  com*/
        try {
            MessageDigest md5 = MessageDigest.getInstance("MD5");
            byte[] bytes = md5.digest(md5Str.getBytes());
            StringBuffer stringBuffer = new StringBuffer();
            for (byte b : bytes) {
                int bt = b & 0xff;
                if (bt < 16) {
                    stringBuffer.append(0);
                }
                stringBuffer.append(Integer.toHexString(bt));
            }
            string = stringBuffer.toString();
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }
        return string;
    }
}

Related

  1. md5String(String key)
  2. md5String(String paramString)
  3. md5String(String s)
  4. md5String(String s)
  5. MD5String(String str)
  6. MD5ToInt(String s)
  7. md5Util(String password)