(password string)
| 20 | } |
| 21 | |
| 22 | func Password2Hash(password string) (string, error) { |
| 23 | passwordBytes := []byte(password) |
| 24 | hashedPassword, err := bcrypt.GenerateFromPassword(passwordBytes, bcrypt.DefaultCost) |
| 25 | return string(hashedPassword), err |
| 26 | } |
| 27 | |
| 28 | func ValidatePasswordAndHash(password string, hash string) bool { |
| 29 | err := bcrypt.CompareHashAndPassword([]byte(hash), []byte(password)) |
no outgoing calls
no test coverage detected