www.pudn.com > TiKuMS.rar > MD5.java
/*
* MD5.java
*
* Created on 2006Äê10ÔÂ20ÈÕ, ÉÏÎç12:10
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package TiKuMS;
import java.security.*;
import java.util.*;
/**
*
* @author hp
*/
public class MD5 {
/** Creates a new instance of MD5 */
private String inStr;
private MessageDigest md5;
/** Creates a new instance of MD5 */
public MD5(String inStr)
{
this.inStr = inStr;
try
{
this.md5 = MessageDigest.getInstance("MD5");
}
catch (Exception e)
{
System.out.println(e.toString());
e.printStackTrace();
}
}
public String compute()
{
char[] charArray = this.inStr.toCharArray();
byte[] byteArray = new byte[charArray.length];
for (int i=0; i