说明:合作方使用的java的提供的示例MD5看如下:
package com.iread.example.util;
import java.security.KeyFactory;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.MessageDigest;
import java.security.SecureRandom;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
public final class SecurityUtil {
public SecurityUtil() {
}
public static byte[] getDigestSHA(String source) throws Exception {
return getDigestSHA(source.getBytes("UTF8"));
}
public static byte[] getDigestSHA(String source, String charset)
throws Exception {
return getDigestSHA(source.getBytes(charset));
}
public static byte[] getDigestSHA(byte source[]) throws Exception {
MessageDigest thisMD = MessageDigest.getInstance("SHA");
byte digest[] = thisMD.digest(source);
return digest;
}
public static String shaEncoding(byte source[]) throws Exception {
return encodeHex(getDigestSHA(source));
}
public static String shaEncoding(String source) throws Exception {
return encodeHex(getDigestSHA(source));
}
public static String shaEncoding(String source, String charset)
throws Exception {
return encodeHex(getDigestSHA(source, charset));
}
public static byte[] getDigestMD5(String source) throws Exception {
return getDigestMD5(source, "UTF8");
}
public static byte[] getDigestMD5(String source, String charset)
throws Exception {
return getD