all repos

onasty @ ffa032688c546167290f5148938aa07d78f1cdd6

a one-time notes service

onasty/internal/hasher/hasher.go(view raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
package hasher

import "errors"

var ErrMismatchedHashes = errors.New("hashes are mismatched")

type Hasher interface {
	// Hash takes a string as input and returns its hash
	Hash(str string) (string, error)

	// Compare takes two hashes and compares them
	// in case of mismatch returns [ErrMismatchedHashes]
	Compare(hash, plain string) error
}