package hmac

import "cuelang.org/go/pkg/crypto/hmac"

Package hmac implements the Keyed-Hash Message Authentication Code (HMAC) as defined in U.S. Federal Information Processing Standards Publication 198.

An HMAC is a cryptographic hash that uses a key to sign a message. The receiver verifies the hash by recomputing it using the same key.

Index

Constants

const (
	MD5        = "MD5"
	SHA1       = "SHA1"
	SHA224     = "SHA224"
	SHA256     = "SHA256"
	SHA384     = "SHA384"
	SHA512     = "SHA512"
	SHA512_224 = "SHA512_224"
	SHA512_256 = "SHA512_256"
)

Functions

func Sign

func Sign(hashName string, key []byte, data []byte) ([]byte, error)

Sign returns the HMAC signature of the data, using the provided key and hash function.

Supported hash functions: "MD5", "SHA1", "SHA224", "SHA256", "SHA384", "SHA512", "SHA512_224", and "SHA512_256".

Source Files

hmac.go pkg.go

Version
v0.12.0 (latest)
Published
Jan 30, 2025
Platform
linux/amd64
Imports
9 packages
Last checked
8 hours ago

Tools for package owners.