HFish/utils/passwd/passwd.go

10 lines
205 B
Go
Raw Normal View History

2020-02-24 19:50:43 +08:00
package passwd
import "regexp"
// 密码脱敏
func Desensitization(str string, x string) string {
re, _ := regexp.Compile("(\\S{1})(\\S{1,20})(\\S{1})")
return re.ReplaceAllString(str, "$1"+x+"$3")
}