mirror of
https://github.com/Snailclimb/JavaGuide
synced 2025-06-16 18:10:13 +08:00
更新加密算法
This commit is contained in:
parent
d74612b492
commit
50aedd1d1b
@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user