fhx
2023-04-06 c1a9eee9c9aa0d3c7592fa75e70243e0297b3a0d
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,9 +68,7 @@
            if(data == null){
                return null;
            }
            if(!isHexStrValid(data)){
                return data;
            }
            if (StringUtils.isEmpty(encoding)) {
                encoding = "UTF-8";
            }
@@ -92,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();
    }