From 10480cd5de5d17b917ac9ea4503fb0bdae5cb479 Mon Sep 17 00:00:00 2001 From: Yutousama <583819556@qq.com> Date: Mon, 16 Mar 2020 22:59:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=B8=80=E4=B8=AAGBK?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=88=B0UTF-8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/yutou/utlis/AESTools.java | 22 ++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/yutou/utlis/AESTools.java b/src/main/java/com/yutou/utlis/AESTools.java index e22d9bf..9d35841 100644 --- a/src/main/java/com/yutou/utlis/AESTools.java +++ b/src/main/java/com/yutou/utlis/AESTools.java @@ -20,7 +20,7 @@ public class AESTools { /** - * 字节数组转化为大写16进制字符串 + * 瀛楄妭鏁扮粍杞寲涓哄ぇ鍐16杩涘埗瀛楃涓 * * @param b * @return @@ -40,7 +40,7 @@ public class AESTools { } /** - * 16进制字符串转字节数组 + * 16杩涘埗瀛楃涓茶浆瀛楄妭鏁扮粍 * * @param s * @return @@ -59,12 +59,12 @@ public class AESTools { /** - * AES 加密 + * AES 鍔犲瘑 * * @param content - * 明文 + * 鏄庢枃 * @param password - * 生成秘钥的关键字 + * 鐢熸垚绉橀挜鐨勫叧閿瓧 * @return */ @@ -76,8 +76,8 @@ public class AESTools { cipher.init(Cipher.ENCRYPT_MODE, key, zeroIv); byte[] encryptedData = cipher.doFinal(content.getBytes(bm)); - // return Base64.encode(encryptedData); - return byte2HexStr(encryptedData); + // return Base64.encode(encryptedData); + return byte2HexStr(encryptedData); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (NoSuchPaddingException e) { @@ -99,19 +99,19 @@ public class AESTools { } /** - * AES 解密 + * AES 瑙e瘑 * * @param content - * 密文 + * 瀵嗘枃 * @param password - * 生成秘钥的关键字 + * 鐢熸垚绉橀挜鐨勫叧閿瓧 * @return */ public static String aesDecrypt(String content, String password) { try { // byte[] byteMi = Base64.decode(content); - byte[] byteMi= str2ByteArray(content); + byte[] byteMi= str2ByteArray(content); IvParameterSpec zeroIv = new IvParameterSpec(VIPARA.getBytes()); SecretKeySpec key = new SecretKeySpec(password.getBytes(), "AES"); Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");