prow/github/hmac.go
func ValidatePayload(payload []byte, sig string, key []byte) bool {
	if !strings.HasPrefix(sig, "sha1=") {
		return false
	}
	sig = sig[5:]
	sb, err := hex.DecodeString(sig)
	if err != nil {
		return false
	}
	mac := hmac.New(sha1.New, key)
	mac.Write(payload)
	expected := mac.Sum(nil)
	return hmac.Equal(sb, expected)
}
func ValidatePayload(payload []byte, sig string, key []byte) bool {
	if !strings.HasPrefix(sig, "sha1=") {
		return false
	}
	sig = sig[5:]
	sb, err := hex.DecodeString(sig)
	if err != nil {
		return false
	}
	mac := hmac.New(sha1.New, key)
	mac.Write(payload)
	expected := mac.Sum(nil)
	return hmac.Equal(sb, expected)
}
func ValidatePayload ( payload [ ] byte , sig string , key [ ] byte ) bool { if ! strings . HasPrefix ( sig , " " ) { return false } sig = sig [ 5 : ] sb , err := hex . DecodeString ( sig ) if err != nil { return false } mac := hmac . New ( sha1 . New , key ) mac . Write ( payload ) expected := mac . Sum ( nil ) return hmac . Equal ( sb , expected ) }
// ValidatePayload ensures that the request payload signature matches the key.
ValidatePayload ensures that the request payload signature matches the key .