|
@@ -102,7 +102,7 @@ public class DESUtil {
|
|
// 执行加密操作。加密后的结果通常都会用Base64编码进行传输
|
|
// 执行加密操作。加密后的结果通常都会用Base64编码进行传输
|
|
// return Base64.encodeBase64String(results);
|
|
// return Base64.encodeBase64String(results);
|
|
|
|
|
|
- return getHash(results);
|
|
|
|
|
|
+ return padding + getHash(results);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -112,6 +112,8 @@ public class DESUtil {
|
|
* @return 解密后的数据
|
|
* @return 解密后的数据
|
|
*/
|
|
*/
|
|
public static String decrypt(String data, String key) throws Exception {
|
|
public static String decrypt(String data, String key) throws Exception {
|
|
|
|
+ data = data.substring(padding.length());
|
|
|
|
+
|
|
Key deskey = keyGenerator(key);
|
|
Key deskey = keyGenerator(key);
|
|
Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM);
|
|
Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM);
|
|
//初始化Cipher对象,设置为解密模式
|
|
//初始化Cipher对象,设置为解密模式
|