From 2aad5c6ca552423d1b8e6e8c869a698a15822759 Mon Sep 17 00:00:00 2001 From: fhx <308050795@qq.com> Date: 星期二, 25 四月 2023 15:32:39 +0800 Subject: [PATCH] 1.修改redis工具 --- src/main/java/com/hx/util/mysql/aes/MysqlHexAesTool.java | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/hx/util/mysql/aes/MysqlHexAesTool.java b/src/main/java/com/hx/util/mysql/aes/MysqlHexAesTool.java index 8ac6a9c..ad8a51b 100644 --- a/src/main/java/com/hx/util/mysql/aes/MysqlHexAesTool.java +++ b/src/main/java/com/hx/util/mysql/aes/MysqlHexAesTool.java @@ -41,6 +41,9 @@ if(data == null){ return null; } + if(!isHexStrValid(data)){ + return data; + } if(StringUtils.isEmpty(encoding)){ encoding = "UTF-8"; } @@ -65,6 +68,7 @@ if(data == null){ return null; } + if (StringUtils.isEmpty(encoding)) { encoding = "UTF-8"; } @@ -89,9 +93,14 @@ * @return true or false */ public static boolean isHexStrValid(String str) { + if(str == null){ return false; } + //鏄惁32浣嶅�嶆暟 + if(str.length()%32 != 0){ + return false; + } String pattern = "^[0-9A-F]+$"; return Pattern.compile(pattern).matcher(str).matches(); } -- Gitblit v1.8.0