package com.sifang.modules.customer.utils;

import com.sifang.modules.sunshine.SystemSetting.utils.StringUtil;

public class EncryptionUtils {

    /**
     * 身份证号加密方法
     * @author
     * @date
     * @param idCardNum 号码
     * @return
     */
    public static String encryptIDCardNum(String idCardNum) {
        if(StringUtil.isBlank(idCardNum)){
            return "";
        }
        StringBuilder sb = new StringBuilder();
        sb.append(idCardNum, 0, 4);
        for (int i = 4; i < idCardNum.length()-4; i++) {
            sb.append("*");
        }
        sb.append(idCardNum.substring(idCardNum.length()-4));
        return sb.toString();
    }

    public static void main(String[] args) {
        System.out.println(encryptIDCardNum("15256947296"));
    }

}
