String2bcryt 返回输入字符串的 bcrypt 哈希值
(str string)
| 51 | |
| 52 | // String2bcryt 返回输入字符串的 bcrypt 哈希值 |
| 53 | func String2bcrypt(str string) string { |
| 54 | hashedPassword, err := bcrypt.GenerateFromPassword([]byte(str), bcrypt.DefaultCost) |
| 55 | if err != nil { |
| 56 | log.Fatalf("Encryption failure: %+v", err) |
| 57 | return "" |
| 58 | } |
| 59 | return string(hashedPassword) |
| 60 | } |
nothing calls this directly
no outgoing calls
no test coverage detected