8 // Verifier presents a general verification interface to be used with message
9 // digests and other byte stream verifications. Users instantiate a Verifier
10 // from one of the various methods, write the data under test to it then check
11 // the result with the Verified method.
12 type Verifier interface {
15 // Verified will return true if the content written to Verifier matches
20 type hashVerifier struct {
25 func (hv hashVerifier) Write(p []byte) (n int, err error) {
26 return hv.hash.Write(p)
29 func (hv hashVerifier) Verified() bool {
30 return hv.digest == NewDigest(hv.digest.Algorithm(), hv.hash)