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

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

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

	return h.Sum(nil), nil
}
func (hs *HmacSigner) SignBytes(buf []byte) ([]byte, error) {
	var err error

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

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

	return h.Sum(nil), nil
}
func ( hs * HmacSigner ) SignBytes ( buf [ ] byte ) ( [ ] byte , error ) { var err error // check hs.key if hs . key == nil { return nil , ErrMissingPrivateKey } // hash h := hmac . New ( hs . hash . New , hs . key ) _ , err = h . Write ( buf ) if err != nil { return nil , err } return h . Sum ( nil ) , nil }
// SignBytes creates a signature for buf.
SignBytes creates a signature for buf .