|
@@ -1,6 +1,7 @@
|
|
|
package com.palatform.yijia;
|
|
|
|
|
|
import com.platform.yijia.utils.CryptUtil;
|
|
|
+import com.platform.yijia.utils.DESUtils;
|
|
|
import lombok.SneakyThrows;
|
|
|
import org.apache.commons.codec.binary.Base64;
|
|
|
import org.apache.commons.codec.digest.DigestUtils;
|
|
@@ -17,24 +18,15 @@ public class test {
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
|
+ String data = "123456";
|
|
|
+ String pwd = "LAnZ8RRSkIY0EGVYheu2IjEk";
|
|
|
+ String encryptDataStr= DESUtils.encrypt(data, pwd);
|
|
|
+ System.out.println("加密后得到的密文......");
|
|
|
+ System.out.println(encryptDataStr);
|
|
|
+ String decryptDataStr=DESUtils.decrypt(encryptDataStr, pwd);
|
|
|
+ System.out.println("解密后得到的明文......");
|
|
|
+ System.out.println(decryptDataStr);
|
|
|
|
|
|
- String data ="123456";
|
|
|
- String pwd = "zhihuiyijia";
|
|
|
-
|
|
|
- byte[] bytes = null;
|
|
|
- try {
|
|
|
- byte[] bytes2 = data.getBytes();
|
|
|
- byte[] bytes3 = pwd.getBytes();
|
|
|
- bytes = CryptUtil.desedeEncrypt(bytes2, bytes3);
|
|
|
- String sss = Base64.encodeBase64String(bytes);
|
|
|
- System.out.println(sss);
|
|
|
-
|
|
|
- byte[] bytes1 = CryptUtil.desedeDecrypt(sss.getBytes(), pwd.getBytes());
|
|
|
- String ssss = Base64.encodeBase64String(bytes1);
|
|
|
- System.out.println(ssss);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
|
|
|
|
|
|
}
|