CheckPwd checks if a password is correct.
(password, hash string)
| 30 | |
| 31 | // CheckPwd checks if a password is correct. |
| 32 | func CheckPwd(password, hash string) bool { |
| 33 | err := bcrypt.CompareHashAndPassword([]byte(hash), []byte(password)) |
| 34 | return err == nil |
| 35 | } |
| 36 | |
| 37 | func RandomPwd(passwordLength uint) (string, error) { |
| 38 | randomPasswordBytes := make([]byte, passwordLength) |