...

Package hmac

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

Overview ▾

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.

Constants

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

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".