javaMD5 java实现MD5算法 关键词: java MD5 import java.security.*; import java.util.*; /** * */ public class MD5 { private String inStr; private MessageDigest md5; /** * Constructs the MD5 object and sets the string whose MD5 is to be computed. * * @param inStr the <code>String</code> whose MD5 is to be computed */ public MD5(String inStr) { this.inStr = inStr; try { this.md5 = MessageDigest.getInstance("MD5"); } catch (Exception e) { System.out.println(e.toString()); e.printStackTrace(); } } /** * Computes the MD5 fingerprint of a string. * * @return the MD5 digest of the input <code>String</code> */ public String compute() { // convert input String to a char[] // convert that char[] to byte[] // get the md5 digest as byte[] // bit-wise AND that byte[] with 0xff
关键词: java MD5
import java.security.*;
import java.util.*;
/**
*
*/
public class MD5
{
private String inStr;
private MessageDigest md5;
/**
* Constructs the MD5 object and sets the string whose MD5 is to be computed.
*
* @param inStr the <code>String</code> whose MD5 is to be computed
*/
public MD5(String inStr)
{
this.inStr = inStr;
try
{
this.md5 = MessageDigest.getInstance("MD5");
}
catch (Exception e)
{
System.out.println(e.toString());
e.printStackTrace();
}
- 粉丝: 0
- 资源: 2
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助