strongduanmu commented on code in PR #23198:
URL: https://github.com/apache/shardingsphere/pull/23198#discussion_r1059587599


##########
docs/document/content/user-manual/common-config/builtin-algorithm/mask.cn.md:
##########
@@ -114,6 +116,8 @@ rules:
           maskAlgorithm: mask_before_special_chars_mask
         telephone:
           maskAlgorithm: keep_first_n_last_m_mask
+        personal_identity_number:

Review Comment:
   Please don't modify the demo config, just modify algrithrom.



##########
features/mask/core/src/test/java/org/apache/shardingsphere/mask/algorithm/replace/PersonalIdentityNumberRandomReplaceAlgorithmTest.java:
##########
@@ -0,0 +1,42 @@
+/*
+ * 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.replace;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+public class PersonalIdentityNumberRandomReplaceAlgorithmTest {

Review Comment:
   Please add final for PersonalIdentityNumberRandomReplaceAlgorithmTest.



##########
docs/document/content/dev-manual/mask.cn.md:
##########
@@ -26,3 +26,4 @@ chapter = true
 | MASK_FROM_X_TO_Y              | 遮盖自 x 至 y 数据脱敏算法 | 
[`org.apache.shardingsphere.mask.algorithm.cover.MASK_FROM_X_TO_Y`](https://github.com/apache/shardingsphere/blob/master/features/mask/core/src/main/java/org/apache/shardingsphere/mask/algorithm/cover/MaskFromXToYMaskAlgorithm.java)
                 |
 | MASK_BEFORE_SPECIAL_CHARS     | 特殊字符前遮盖数据脱敏算法   | 
[`org.apache.shardingsphere.mask.algorithm.cover.MASK_BEFORE_SPECIAL_CHARS`](https://github.com/apache/shardingsphere/blob/master/features/mask/core/src/main/java/org/apache/shardingsphere/mask/algorithm/cover/MaskBeforeSpecialCharsAlgorithm.java)
                 |
 | MASK_AFTER_SPECIAL_CHARS      | 特殊字符后遮盖数据脱敏算法   | 
[`org.apache.shardingsphere.mask.algorithm.cover.MASK_AFTER_SPECIAL_CHARS`](https://github.com/apache/shardingsphere/blob/master/features/mask/core/src/main/java/org/apache/shardingsphere/mask/algorithm/cover/MaskAfterSpecialCharsAlgorithm.java)
                 |
+| PERSONAL_IDENTITY_NUMBER_RANDOM_REPLACE      | 身份证前6位行政区编码随机替换脱敏算法   | 
[`org.apache.shardingsphere.mask.algorithm.replace.PERSONAL_IDENTITY_NUMBER_RANDOM_REPLACE`](https://github.com/apache/shardingsphere/blob/master/features/mask/core/src/main/java/org/apache/shardingsphere/mask/algorithm/replace/PersonalIdentityNumberRandomReplaceAlgorithm.java)
                 |

Review Comment:
   Hi @liushangqing9803, what we need to replace is the birthday information in 
the middle of the ID card.



##########
features/mask/core/src/main/java/org/apache/shardingsphere/mask/algorithm/replace/PersonalIdentityNumberRandomReplaceAlgorithm.java:
##########
@@ -0,0 +1,64 @@
+/*
+ * 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.replace;
+
+import com.google.common.base.Strings;
+import lombok.Getter;
+import org.apache.shardingsphere.mask.spi.MaskAlgorithm;
+
+import java.util.Properties;
+import java.util.Random;
+
+/**
+ * personal identity number random replace.
+ * random replacement of the first 6 bits.
+ */
+public class PersonalIdentityNumberRandomReplaceAlgorithm implements 
MaskAlgorithm<Object, String> {

Review Comment:
   Please add final for PersonalIdentityNumberRandomReplaceAlgorithm.



##########
features/mask/core/src/main/java/org/apache/shardingsphere/mask/algorithm/replace/PersonalIdentityNumberRandomReplaceAlgorithm.java:
##########
@@ -0,0 +1,64 @@
+/*
+ * 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.replace;
+
+import com.google.common.base.Strings;
+import lombok.Getter;
+import org.apache.shardingsphere.mask.spi.MaskAlgorithm;
+
+import java.util.Properties;
+import java.util.Random;
+
+/**
+ * personal identity number random replace.

Review Comment:
   Please keep the first letter of javadoc uppercase.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to