Java加密跟解密

2021-06-03 15:58:35 字數 1216 閱讀 2653

具體事項請直接看**:

public static final string key_md5 = "md5";

public static byte encryp***5(byte input) throws exception

public static string encryp***5bybase64(byte input) throws exception

public static void main(string args) catch (exception e) }

/*** 通過 md5加密

* @param str

* @return

* @throws exception

*/public static string addsecurity(string str) throws exception

/*** 通過md5加密後再用base64加密

* @param str

* @return

* @throws exception

*/public static string addsecuritybybase64(string str) throws exception

/*** 普通方法加密

* @return

*/public static string addnormalsecurity(string str)

result = new string(arr);

return result; }

/*** 解密普通方法的加密

* @return

*/public static string unaddnormalsecurity(string str)

result = new string(arr);

return result;

}

該**的執行結果:

md5加密前的字串:abc

md5加密後的字串:-6ffeaf67c32db04f2969c082d71e808e

md5 and base64加密前的字串:abc

md5 and base64加密後的字串:kafqmdzst7dwlj99kof/cg==

正常加密前的字串:abc

正常加密前的後字串:

正常加密前的後字串:abc

正常加密前的後解密的字串:

java 加密解密演算法

public class cryptogram 金鑰 private static final int key 5 param args public static void main string args char encryptcode cryptogram.encrypt in system...

Java加密解密 Jasypt

1.download url 2.依賴 jar jasypt 1.9.0.jar 3.加密 預設加密 解密演算法是 pbewithmd5anddes standardpbestringencryptor encryptor new standardpbestringencryptor encrypt...

java加密與解密(二)

數字證書 一 證書管理 1.keytool證書管理 1 本地數字證書生成命令 keytool genkeypair alias www.zlex.org keyalg rsa keysize 2048 sigalg sha1withrsa validity 36000 keystore zlex.k...