hmac

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package hmac provides utilities for signing and verifying messages using HMAC.

Index

Constants

This section is empty.

Variables

View Source
var ErrHashUnavailable = errors.New("hmac: requested hash function is unavailable")

ErrHashUnavailable is returned when the hash function is not linked into the binary.

Functions

This section is empty.

Types

type HMAC

type HMAC struct {
	// contains filtered or unexported fields
}

HMAC signs messages and verifies message signatures using HMAC. It is safe for concurrent use by multiple goroutines.

func New

func New(key []byte, hash crypto.Hash) (*HMAC, error)

New returns a new HMAC for the provided key and hash algorithm.

func (HMAC) Sign

func (h HMAC) Sign(message []byte) ([]byte, error)

Sign signs a message using the key.

func (HMAC) Verify

func (h HMAC) Verify(message []byte, signature []byte) (bool, error)

Verify verifies the signature of a message using the key.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL