onasty/internal/hasher/hasher.go (view raw)
Smirnov Oleksandr
Smirnov Oleksandr
ss2316544@gmail.com refactor: fix annoyances (#97)..., 1 year ago
ss2316544@gmail.com refactor: fix annoyances (#97)..., 1 year ago
| 1 | package hasher |
| 2 | |
| 3 | import "errors" |
| 4 | |
| 5 | var ErrMismatchedHashes = errors.New("hashes are mismatched") |
| 6 | |
| 7 | type Hasher interface { |
| 8 | // Hash takes a string as input and returns its hash |
| 9 | Hash(str string) (string, error) |
| 10 | |
| 11 | // Compare takes two hashes and compares them |
| 12 | // in case of mismatch returns [ErrMismatchedHashes] |
| 13 | Compare(hash, plain string) error |
| 14 | } |