Hasher provides methods for generating and comparing password hashes.
| 6 | |
| 7 | // Hasher provides methods for generating and comparing password hashes. |
| 8 | type Hasher interface { |
| 9 | // Generate returns a hash derived from the password or an error if the hash method failed. |
| 10 | Generate(ctx context.Context, password []byte) ([]byte, error) |
| 11 | |
| 12 | // Understands returns whether the given hash can be understood by this hasher. |
| 13 | Understands(hash []byte) bool |
| 14 | } |
| 15 | |
| 16 | type HashProvider interface { |
| 17 | Hasher() Hasher |