提交 50aedd1d 编写于 作者: S Snailclimb

更新加密算法

上级 d74612b4
......@@ -27,9 +27,9 @@ public class DesDemo {
byte[] result;
try {
result = DesDemo.encrypt(str.getBytes(), password);
System.out.println("加密后:" + new String(result));
System.out.println("加密后:" + result);
byte[] decryResult = DesDemo.decrypt(result, password);
System.out.println("解密后:" + new String(decryResult));
System.out.println("解密后:" + decryResult);
} catch (UnsupportedEncodingException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
......
......@@ -28,9 +28,9 @@ public class RSADemo {
System.out.println("-----------------------------------");
byte[] encryptByPrivateKey = encryptByPrivateKey("123456".getBytes(), privateKey);
byte[] encryptByPublicKey = encryptByPublicKey("123456", publicKey);
System.out.println(new String(encryptByPrivateKey));
System.out.println(encryptByPrivateKey);
System.out.println("-----------------------------------");
System.out.println(new String(encryptByPublicKey));
System.out.println(encryptByPublicKey);
System.out.println("-----------------------------------");
String sign = sign(encryptByPrivateKey, privateKey);
System.out.println(sign);
......@@ -40,9 +40,9 @@ public class RSADemo {
System.out.println("-----------------------------------");
byte[] decryptByPublicKey = decryptByPublicKey(encryptByPrivateKey, publicKey);
byte[] decryptByPrivateKey = decryptByPrivateKey(encryptByPublicKey, privateKey);
System.out.println(new String(decryptByPublicKey));
System.out.println(decryptByPublicKey);
System.out.println("-----------------------------------");
System.out.println(new String(decryptByPrivateKey));
System.out.println(decryptByPrivateKey);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册