HashPassword hashes a plaintext password using bcrypt
(password string)
| 8 | |
| 9 | // HashPassword hashes a plaintext password using bcrypt |
| 10 | func HashPassword(password string) (string, error) { |
| 11 | hash, err := bcrypt.GenerateFromPassword([]byte(password), bcryptCost) |
| 12 | if err != nil { |
| 13 | return "", err |
| 14 | } |
| 15 | return string(hash), nil |
| 16 | } |
| 17 | |
| 18 | // VerifyPassword verifies a plaintext password against a bcrypt hash |
| 19 | func VerifyPassword(hash, password string) bool { |
no outgoing calls