func genMd5(code string) string {m := md5.New()_, _ = io.WriteString(m, code)return hex.EncodeToString(m.Sum(nil))}
go get github.com/anaskhan96/go-password-encoder
//salt, encodedPwd := password.Encode("generic password", nil)//fmt.Println("salt", salt)//fmt.Println("encodedPwd", encodedPwd)//check := password.Verify("generic password", salt, encodedPwd, nil)//fmt.Println(check) // true// Using custom optionsoptions := &password.Options{SaltLen: 16, Iterations: 100, KeyLen: 32, HashFunction: sha512.New}salt, encodedPwd := password.Encode("generic password", options)passwd := fmt.Sprintf("$pbkdf2-sha512$%s$%s", salt, encodedPwd)fmt.Println("len(passwd)", len(passwd))fmt.Println("passwd", passwd)passwdInfo := strings.Split(passwd, "$")check := password.Verify("generic password", passwdInfo[2], passwdInfo[3], options)fmt.Println(check) // true
