hmac.go
func (hs *HmacSigner) VerifyBytes(buf, sig []byte) error {
	var err error

	// check hs.key
	if hs.key == nil {
		return ErrMissingPrivateKey
	}

	// hash
	h := hmac.New(hs.hash.New, hs.key)
	_, err = h.Write(buf)
	if err != nil {
		return err
	}

	// verify
	if !hmac.Equal(h.Sum(nil), sig) {
		return ErrInvalidSignature
	}

	return nil
}
func (hs *HmacSigner) VerifyBytes(buf, sig []byte) error {
	var err error

	// check hs.key
	if hs.key == nil {
		return ErrMissingPrivateKey
	}

	// hash
	h := hmac.New(hs.hash.New, hs.key)
	_, err = h.Write(buf)
	if err != nil {
		return err
	}

	// verify
	if !hmac.Equal(h.Sum(nil), sig) {
		return ErrInvalidSignature
	}

	return nil
}
// VerifyBytes creates a signature for buf, comparing it against the raw sig.
// If the sig is invalid, then ErrInvalidSignature is returned.