You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by tu...@apache.org on 2022/12/09 09:09:44 UTC

[shardingsphere] branch master updated: initialize the mask module and add the underlying spi interface, mask rule class (#22766)

This is an automated email from the ASF dual-hosted git repository.

tuichenchuxin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 509a27b4a99 initialize the mask module and add the underlying spi interface, mask rule class (#22766)
509a27b4a99 is described below

commit 509a27b4a99239c9abeb643554a91884fb8b1c26
Author: Zhengqiang Duan <du...@apache.org>
AuthorDate: Fri Dec 9 17:09:35 2022 +0800

    initialize the mask module and add the underlying spi interface, mask rule class (#22766)
---
 features/{ => mask/api}/pom.xml                    | 19 ++++---
 .../mask/api/config/MaskRuleConfiguration.java     | 40 +++++++++++++++
 .../config/rule/MaskColumnRuleConfiguration.java   | 33 ++++++++++++
 .../config/rule/MaskTableRuleConfiguration.java    | 35 +++++++++++++
 .../mask/factory/MaskAlgorithmFactory.java         | 48 +++++++++++++++++
 .../shardingsphere/mask/spi/MaskAlgorithm.java     | 37 +++++++++++++
 features/{ => mask/core}/pom.xml                   | 29 +++++++----
 .../mask/algorithm/hash/MD5MaskAlgorithm.java      | 48 +++++++++++++++++
 .../shardingsphere/mask/constant/MaskOrder.java    | 33 ++++++++++++
 .../shardingsphere/mask/rule/MaskColumn.java       | 33 ++++++++++++
 .../apache/shardingsphere/mask/rule/MaskRule.java  | 60 ++++++++++++++++++++++
 .../apache/shardingsphere/mask/rule/MaskTable.java | 39 ++++++++++++++
 ...rg.apache.shardingsphere.mask.spi.MaskAlgorithm | 18 +++++++
 features/{ => mask}/pom.xml                        | 11 ++--
 features/pom.xml                                   |  1 +
 15 files changed, 457 insertions(+), 27 deletions(-)

diff --git a/features/pom.xml b/features/mask/api/pom.xml
similarity index 78%
copy from features/pom.xml
copy to features/mask/api/pom.xml
index 12c5fcb93f2..b00fc776db0 100644
--- a/features/pom.xml
+++ b/features/mask/api/pom.xml
@@ -21,18 +21,17 @@
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache.shardingsphere</groupId>
-        <artifactId>shardingsphere</artifactId>
+        <artifactId>shardingsphere-mask</artifactId>
         <version>5.2.2-SNAPSHOT</version>
     </parent>
-    <artifactId>shardingsphere-features</artifactId>
-    <packaging>pom</packaging>
+    <artifactId>shardingsphere-mask-api</artifactId>
     <name>${project.artifactId}</name>
     
-    <modules>
-        <module>sharding</module>
-        <module>readwrite-splitting</module>
-        <module>db-discovery</module>
-        <module>encrypt</module>
-        <module>shadow</module>
-    </modules>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.shardingsphere</groupId>
+            <artifactId>shardingsphere-infra-common</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
 </project>
diff --git a/features/mask/api/src/main/java/org/apache/shardingsphere/mask/api/config/MaskRuleConfiguration.java b/features/mask/api/src/main/java/org/apache/shardingsphere/mask/api/config/MaskRuleConfiguration.java
new file mode 100644
index 00000000000..cd65dc4972b
--- /dev/null
+++ b/features/mask/api/src/main/java/org/apache/shardingsphere/mask/api/config/MaskRuleConfiguration.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.mask.api.config;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
+import org.apache.shardingsphere.infra.config.rule.function.EnhancedRuleConfiguration;
+import org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfiguration;
+import org.apache.shardingsphere.mask.api.config.rule.MaskTableRuleConfiguration;
+
+import java.util.Collection;
+import java.util.Map;
+
+/**
+ * Mask rule configuration.
+ */
+@RequiredArgsConstructor
+@Getter
+public final class MaskRuleConfiguration implements DatabaseRuleConfiguration, EnhancedRuleConfiguration {
+    
+    private final Collection<MaskTableRuleConfiguration> tables;
+    
+    private final Map<String, AlgorithmConfiguration> maskAlgorithms;
+}
diff --git a/features/mask/api/src/main/java/org/apache/shardingsphere/mask/api/config/rule/MaskColumnRuleConfiguration.java b/features/mask/api/src/main/java/org/apache/shardingsphere/mask/api/config/rule/MaskColumnRuleConfiguration.java
new file mode 100644
index 00000000000..5af5341a342
--- /dev/null
+++ b/features/mask/api/src/main/java/org/apache/shardingsphere/mask/api/config/rule/MaskColumnRuleConfiguration.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.mask.api.config.rule;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+
+/**
+ * Mask column rule configuration.
+ */
+@RequiredArgsConstructor
+@Getter
+public final class MaskColumnRuleConfiguration {
+    
+    private final String logicColumn;
+    
+    private final String maskAlgorithm;
+}
diff --git a/features/mask/api/src/main/java/org/apache/shardingsphere/mask/api/config/rule/MaskTableRuleConfiguration.java b/features/mask/api/src/main/java/org/apache/shardingsphere/mask/api/config/rule/MaskTableRuleConfiguration.java
new file mode 100644
index 00000000000..dba8261297d
--- /dev/null
+++ b/features/mask/api/src/main/java/org/apache/shardingsphere/mask/api/config/rule/MaskTableRuleConfiguration.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.mask.api.config.rule;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+
+import java.util.Collection;
+
+/**
+ * Mask table rule configuration.
+ */
+@RequiredArgsConstructor
+@Getter
+public final class MaskTableRuleConfiguration {
+    
+    private final String name;
+    
+    private final Collection<MaskColumnRuleConfiguration> columns;
+}
diff --git a/features/mask/api/src/main/java/org/apache/shardingsphere/mask/factory/MaskAlgorithmFactory.java b/features/mask/api/src/main/java/org/apache/shardingsphere/mask/factory/MaskAlgorithmFactory.java
new file mode 100644
index 00000000000..8721f0ae60b
--- /dev/null
+++ b/features/mask/api/src/main/java/org/apache/shardingsphere/mask/factory/MaskAlgorithmFactory.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.mask.factory;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import org.apache.shardingsphere.infra.algorithm.ShardingSphereAlgorithmFactory;
+import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
+import org.apache.shardingsphere.infra.util.spi.ShardingSphereServiceLoader;
+import org.apache.shardingsphere.mask.spi.MaskAlgorithm;
+
+/**
+ * Mask algorithm factory.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class MaskAlgorithmFactory {
+    
+    static {
+        ShardingSphereServiceLoader.register(MaskAlgorithm.class);
+    }
+    
+    /**
+     * Create new instance of mask algorithm.
+     * 
+     * @param maskAlgorithmConfig mask algorithm configuration
+     * @param <I> type of plain value
+     * @param <O> type of masked value
+     * @return created instance
+     */
+    public static <I, O> MaskAlgorithm<I, O> newInstance(final AlgorithmConfiguration maskAlgorithmConfig) {
+        return ShardingSphereAlgorithmFactory.createAlgorithm(maskAlgorithmConfig, MaskAlgorithm.class);
+    }
+}
diff --git a/features/mask/api/src/main/java/org/apache/shardingsphere/mask/spi/MaskAlgorithm.java b/features/mask/api/src/main/java/org/apache/shardingsphere/mask/spi/MaskAlgorithm.java
new file mode 100644
index 00000000000..30406bd0d38
--- /dev/null
+++ b/features/mask/api/src/main/java/org/apache/shardingsphere/mask/spi/MaskAlgorithm.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.mask.spi;
+
+import org.apache.shardingsphere.infra.algorithm.ShardingSphereAlgorithm;
+
+/**
+ * Mask algorithm.
+ *
+ * @param <I> type of plain value
+ * @param <O> type of masked value
+ */
+public interface MaskAlgorithm<I, O> extends ShardingSphereAlgorithm {
+    
+    /**
+     * Mask.
+     *
+     * @param plainValue plain value
+     * @return masked value
+     */
+    O mask(I plainValue);
+}
diff --git a/features/pom.xml b/features/mask/core/pom.xml
similarity index 64%
copy from features/pom.xml
copy to features/mask/core/pom.xml
index 12c5fcb93f2..a65e7fb7e68 100644
--- a/features/pom.xml
+++ b/features/mask/core/pom.xml
@@ -21,18 +21,27 @@
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache.shardingsphere</groupId>
-        <artifactId>shardingsphere</artifactId>
+        <artifactId>shardingsphere-mask</artifactId>
         <version>5.2.2-SNAPSHOT</version>
     </parent>
-    <artifactId>shardingsphere-features</artifactId>
-    <packaging>pom</packaging>
+    <artifactId>shardingsphere-mask-core</artifactId>
     <name>${project.artifactId}</name>
     
-    <modules>
-        <module>sharding</module>
-        <module>readwrite-splitting</module>
-        <module>db-discovery</module>
-        <module>encrypt</module>
-        <module>shadow</module>
-    </modules>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.shardingsphere</groupId>
+            <artifactId>shardingsphere-mask-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.shardingsphere</groupId>
+            <artifactId>shardingsphere-infra-merge</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        
+        <dependency>
+            <groupId>commons-codec</groupId>
+            <artifactId>commons-codec</artifactId>
+        </dependency>
+    </dependencies>
 </project>
diff --git a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/algorithm/hash/MD5MaskAlgorithm.java b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/algorithm/hash/MD5MaskAlgorithm.java
new file mode 100644
index 00000000000..52ad6a50f53
--- /dev/null
+++ b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/algorithm/hash/MD5MaskAlgorithm.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.mask.algorithm.hash;
+
+import lombok.Getter;
+import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.shardingsphere.mask.spi.MaskAlgorithm;
+
+import java.util.Properties;
+
+/**
+ * MD5 mask algorithm.
+ */
+@Getter
+public final class MD5MaskAlgorithm implements MaskAlgorithm<Object, String> {
+    
+    private Properties props;
+    
+    @Override
+    public void init(final Properties props) {
+        this.props = props;
+    }
+    
+    @Override
+    public String mask(final Object plainValue) {
+        return null == plainValue ? null : DigestUtils.md5Hex(String.valueOf(plainValue));
+    }
+    
+    @Override
+    public String getType() {
+        return "MD5";
+    }
+}
diff --git a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/constant/MaskOrder.java b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/constant/MaskOrder.java
new file mode 100644
index 00000000000..7e1c97b5380
--- /dev/null
+++ b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/constant/MaskOrder.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.mask.constant;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+
+/**
+ * Mask order.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class MaskOrder {
+    
+    /**
+     * Mask order.
+     */
+    public static final int ORDER = 20;
+}
diff --git a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/rule/MaskColumn.java b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/rule/MaskColumn.java
new file mode 100644
index 00000000000..d39e3482c92
--- /dev/null
+++ b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/rule/MaskColumn.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.mask.rule;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+
+/**
+ * Mask column.
+ */
+@RequiredArgsConstructor
+@Getter
+public final class MaskColumn {
+    
+    private final String logicColumn;
+    
+    private final String maskAlgorithm;
+}
diff --git a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/rule/MaskRule.java b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/rule/MaskRule.java
new file mode 100644
index 00000000000..4bb1c266e47
--- /dev/null
+++ b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/rule/MaskRule.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.mask.rule;
+
+import lombok.Getter;
+import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
+import org.apache.shardingsphere.infra.rule.identifier.scope.DatabaseRule;
+import org.apache.shardingsphere.infra.rule.identifier.type.TableContainedRule;
+import org.apache.shardingsphere.mask.api.config.MaskRuleConfiguration;
+import org.apache.shardingsphere.mask.factory.MaskAlgorithmFactory;
+import org.apache.shardingsphere.mask.spi.MaskAlgorithm;
+
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * Mask rule.
+ */
+@SuppressWarnings("rawtypes")
+public final class MaskRule implements DatabaseRule, TableContainedRule {
+    
+    @Getter
+    private final RuleConfiguration configuration;
+    
+    private final Map<String, MaskAlgorithm> maskAlgorithms = new LinkedHashMap<>();
+    
+    private final Map<String, MaskTable> tables = new LinkedHashMap<>();
+    
+    public MaskRule(final MaskRuleConfiguration ruleConfig) {
+        configuration = ruleConfig;
+        ruleConfig.getMaskAlgorithms().forEach((key, value) -> maskAlgorithms.put(key, MaskAlgorithmFactory.newInstance(value)));
+        ruleConfig.getTables().forEach(each -> tables.put(each.getName().toLowerCase(), new MaskTable(each)));
+    }
+    
+    @Override
+    public Collection<String> getTables() {
+        return tables.keySet();
+    }
+    
+    @Override
+    public String getType() {
+        return MaskRule.class.getSimpleName();
+    }
+}
diff --git a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/rule/MaskTable.java b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/rule/MaskTable.java
new file mode 100644
index 00000000000..01237219ff6
--- /dev/null
+++ b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/rule/MaskTable.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.mask.rule;
+
+import org.apache.shardingsphere.mask.api.config.rule.MaskColumnRuleConfiguration;
+import org.apache.shardingsphere.mask.api.config.rule.MaskTableRuleConfiguration;
+
+import java.util.Map;
+import java.util.TreeMap;
+
+/**
+ * Mask table.
+ */
+public final class MaskTable {
+    
+    private final Map<String, MaskColumn> columns;
+    
+    public MaskTable(final MaskTableRuleConfiguration config) {
+        columns = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
+        for (MaskColumnRuleConfiguration each : config.getColumns()) {
+            columns.put(each.getLogicColumn(), new MaskColumn(each.getLogicColumn(), each.getMaskAlgorithm()));
+        }
+    }
+}
diff --git a/features/mask/core/src/main/resources/META-INF/services/org.apache.shardingsphere.mask.spi.MaskAlgorithm b/features/mask/core/src/main/resources/META-INF/services/org.apache.shardingsphere.mask.spi.MaskAlgorithm
new file mode 100644
index 00000000000..4d37c2cb819
--- /dev/null
+++ b/features/mask/core/src/main/resources/META-INF/services/org.apache.shardingsphere.mask.spi.MaskAlgorithm
@@ -0,0 +1,18 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+org.apache.shardingsphere.mask.algorithm.hash.MD5MaskAlgorithm
diff --git a/features/pom.xml b/features/mask/pom.xml
similarity index 82%
copy from features/pom.xml
copy to features/mask/pom.xml
index 12c5fcb93f2..a673cc4c1f9 100644
--- a/features/pom.xml
+++ b/features/mask/pom.xml
@@ -21,18 +21,15 @@
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache.shardingsphere</groupId>
-        <artifactId>shardingsphere</artifactId>
+        <artifactId>shardingsphere-features</artifactId>
         <version>5.2.2-SNAPSHOT</version>
     </parent>
-    <artifactId>shardingsphere-features</artifactId>
+    <artifactId>shardingsphere-mask</artifactId>
     <packaging>pom</packaging>
     <name>${project.artifactId}</name>
     
     <modules>
-        <module>sharding</module>
-        <module>readwrite-splitting</module>
-        <module>db-discovery</module>
-        <module>encrypt</module>
-        <module>shadow</module>
+        <module>api</module>
+        <module>core</module>
     </modules>
 </project>
diff --git a/features/pom.xml b/features/pom.xml
index 12c5fcb93f2..871ed20e5e6 100644
--- a/features/pom.xml
+++ b/features/pom.xml
@@ -34,5 +34,6 @@
         <module>db-discovery</module>
         <module>encrypt</module>
         <module>shadow</module>
+        <module>mask</module>
     </modules>
 </project>