zhouxiang
2022-03-24 db287aac9eb5032b1158b405a9b4807301467ed3
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();
    }