千寻位置 v2.8.9版本的 MD5 值为:c028423c956e81d2a162977350c0ec2e
以下内容为反编译后的 DesensitizationUtil.java 源代码,内容仅作参考
package com.qx.wz.qxwz.util;
import androidx.webkit.ProxyConfig;
import com.qx.wz.logger.Logger;
import com.qx.wz.utils.StringUtil;
public class DesensitizationUtil {
private static final int EMAIL_DEFAULT_NUMBER = 3;
private static final String EMAIL_DESENSITIZATION_TAG = "***";
public static String desensitizeEmail(String str) {
String str2;
if (StringUtil.isBlank(str)) {
return "";
}
String[] split = StringUtil.split(str, "@");
if (split.length != 2) {
return str;
}
String str3 = split[0];
if (str3.length() <= 3) {
str2 = str3 + EMAIL_DESENSITIZATION_TAG;
} else {
str2 = str3.substring(0, 3) + EMAIL_DESENSITIZATION_TAG;
}
return String.format("%s@%s", str2, split[1]);
}
public static String desensitizePhone(String str) {
if (StringUtil.isBlank(str)) {
return "";
}
if (!StringUtil.isNotBlank(str) || str.length() <= 7 || str.contains(ProxyConfig.MATCH_ALL_SCHEMES)) {
return str;
}
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(str.substring(0, 3));
stringBuffer.append("****");
stringBuffer.append(str.substring(7, str.length()));
return stringBuffer.toString();
}
public static void main(String[] strArr) {
Logger.d("DesensitizationUtil " + desensitizeEmail("a@126.com"), "");
Logger.d("DesensitizationUtil " + desensitizeEmail("126"), "");
Logger.d("DesensitizationUtil " + desensitizeEmail("126.com"), "");
Logger.d("DesensitizationUtil " + desensitizeEmail("@@126.com"), "");
Logger.d("DesensitizationUtil " + desensitizeEmail("ab@126.com"), "");
Logger.d("DesensitizationUtil " + desensitizeEmail("abc@126.com"), "");
Logger.d("DesensitizationUtil " + desensitizeEmail("abcd@126.com"), "");
Logger.d("DesensitizationUtil " + desensitizeEmail("abcde@126.com"), "");
Logger.d("DesensitizationUtil " + desensitizeEmail("abcdef@126.com"), "");
Logger.d("DesensitizationUtil " + desensitizeEmail("abcdefg@126.com"), "");
Logger.d("DesensitizationUtil " + desensitizeEmail("abcdefg123@126.com"), "");
Logger.d("DesensitizationUtil " + desensitizePhone("139816"), "");
Logger.d("DesensitizationUtil " + desensitizePhone("1398167"), "");
Logger.d("DesensitizationUtil " + desensitizePhone("13981678"), "");
Logger.d("DesensitizationUtil " + desensitizePhone("1398167892"), "");
Logger.d("DesensitizationUtil " + desensitizePhone("13981678920"), "");
Logger.d("DesensitizationUtil " + desensitizePhone("1398*6"), "");
Logger.d("DesensitizationUtil " + desensitizePhone("13981*7"), "");
Logger.d("DesensitizationUtil " + desensitizePhone("139816*8"), "");
Logger.d("DesensitizationUtil " + desensitizePhone("139*167892"), "");
Logger.d("DesensitizationUtil " + desensitizePhone("1398167892*"), "");
Logger.d("DesensitizationUtil " + desensitizePhone("1398***123*"), "");
Logger.d("DesensitizationUtil " + desensitizePhone("139816789**"), "");
Logger.d("DesensitizationUtil " + desensitizePhone("13981671***"), "");
Logger.d("DesensitizationUtil " + desensitizePhone("1398167****"), "");
Logger.d("DesensitizationUtil " + desensitizePhone("139816*****"), "");
}
}