import java.security.*;
import java.security.spec.*;
public class PieChart
{
public final static void main(String arg[])
{
char hexDigits[] = {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd',
'e', 'f'};
String s="123456";
try
{
byte[] strTemp = s.getBytes();
MessageDigest mdTemp = MessageDigest.getInstance("MD5");
mdTemp.update(strTemp);
byte[] md = mdTemp.digest();
int j = md.length;
char str[] = new char[j * 2];
int k = 0;
for (int i = 0; i < j; i++)
{
byte byte0 = md[i];
str[k++] = hexDigits[byte0 >>> 4 & 0xf];
str[k++] = hexDigits[byte0 & 0xf];
}
}
catch(Exception e){}
}
} 连输出都没有,不知道是实现什么的
import java.security.spec.*;
public class PieChart
{
public final static void main(String arg[])
{
char hexDigits[] = {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd',
'e', 'f'};
String s="123456";
try
{
byte[] strTemp = s.getBytes();
MessageDigest mdTemp = MessageDigest.getInstance("MD5");
mdTemp.update(strTemp);
byte[] md = mdTemp.digest();
int j = md.length;
char str[] = new char[j * 2];
int k = 0;
for (int i = 0; i < j; i++)
{
byte byte0 = md[i];
str[k++] = hexDigits[byte0 >>> 4 & 0xf];
str[k++] = hexDigits[byte0 & 0xf];
}
}
catch(Exception e){}
}
} 连输出都没有,不知道是实现什么的
* encrypted password based on JCA algorithm of message digest
* @param plainText orginal password text
* @param algorithm name of algorithm
* @return encrypted password
*/
public static String encrypte(String plainText, String algorithm) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance(algorithm);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
md.update(plainText.getBytes());
byte[] b = md.digest();
StringBuffer output = new StringBuffer();
for(int i = 0; i < b.length; i++) {
String temp = Integer.toHexString(b[i] & 0xff);
if(temp.length() < 2){
output.append("0");
}
output.append(temp);
}
return output.toString();
}