CreatePassword returns a hashed version of the given password.
(pw string, strength int)
| 4 | |
| 5 | // CreatePassword returns a hashed version of the given password. |
| 6 | func CreatePassword(pw string, strength int) []byte { |
| 7 | hashedPassword, err := bcrypt.GenerateFromPassword([]byte(pw), strength) |
| 8 | if err != nil { |
| 9 | panic(err) |
| 10 | } |
| 11 | return hashedPassword |
| 12 | } |
| 13 | |
| 14 | // ComparePassword compares a hashed password with its possible plaintext equivalent. |
| 15 | func ComparePassword(hashedPassword, password []byte) bool { |
no outgoing calls
searching dependent graphs…