hmac

package
v1.99.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Method

type Method struct {
	Secret   []byte
	HashFunc func() hash.Hash
	Name     string
}

func New

func New(algorithm string, secret []byte) (*Method, error)

func (*Method) GetName

func (method *Method) GetName() string

func (*Method) GoString added in v1.86.0

func (method *Method) GoString() string

GoString writes the method out without its secret, and String and MarshalText write the same.

A method is attached to errors and so to log entries, and every way a value is written out would otherwise write the secret along with it: %#v and %v print its bytes, a JSON encoder its base64.

func (*Method) MarshalText added in v1.86.0

func (method *Method) MarshalText() ([]byte, error)

func (*Method) Sign

func (method *Method) Sign(message []byte) ([]byte, error)

func (*Method) String added in v1.86.0

func (method *Method) String() string

func (*Method) Verify

func (method *Method) Verify(message []byte, signature []byte) error

Jump to

Keyboard shortcuts

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