public static byte[] hexStringToByteArray(String hex) {
        if (hex.length() % 2 != 0) {
            throw new IllegalArgumentException("Hex string length must be even");
        }
        byte[] bytes = new byte[hex.length() / 2];
        for (int i = 0; i < hex.length(); i += 2) {
            String byteString = hex.substring(i, i + 2);
            bytes[i / 2] = (byte) Integer.parseInt(byteString, 16);
        }
        return bytes;
    }
CommonCipher Public encryption/decryption

@author lzy
chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/ncx/cipher/CommonCipher.java