hmac

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package hmac implements the functions, types, and interfaces for the module.

Package hmac implements the functions, types, and interfaces for the module.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultConfig

func DefaultConfig() *types.Config

func NewHMAC added in v0.3.18

func NewHMAC(algSpec types.Spec, config *types.Config) (scheme.Scheme, error)

NewHMAC creates a new HMAC crypto instance

func ResolveSpec added in v1.1.0

func ResolveSpec(algSpec types.Spec) (types.Spec, error)

ResolveSpec resolves the Spec for HMAC, providing a default underlying hash if not specified.

Types

type ConfigValidator

type ConfigValidator struct {
	SaltLength int
}

func (ConfigValidator) Validate

func (v ConfigValidator) Validate(config *types.Config) error

type HMAC

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

HMAC implements the HMAC hashing algorithm

func (*HMAC) Hash

func (c *HMAC) Hash(password string) (*types.HashParts, error)

Hash implements the hash method

func (*HMAC) HashWithSalt

func (c *HMAC) HashWithSalt(password string, salt []byte) (*types.HashParts, error)

HashWithSalt implements the hash with salt method

func (*HMAC) Spec added in v1.1.0

func (c *HMAC) Spec() types.Spec

func (*HMAC) Verify

func (c *HMAC) Verify(parts *types.HashParts, password string) error

Verify implements the verify method

type Params added in v0.2.17

type Params struct {
}

Params represents parameters for HMAC algorithm

func DefaultParams added in v1.1.0

func DefaultParams() *Params

func FromMap added in v0.3.18

func FromMap(m map[string]string) (params *Params, err error)

FromMap parses Argon2 parameters from string

func (*Params) FromMap added in v0.3.18

func (p *Params) FromMap(params map[string]string) error

func (*Params) IsNil added in v1.1.0

func (p *Params) IsNil() bool

func (*Params) String added in v0.2.17

func (p *Params) String() string

String returns the string representation of parameters

func (*Params) ToMap added in v0.3.18

func (p *Params) ToMap() map[string]string

func (*Params) Validate added in v0.3.18

func (p *Params) Validate(config *types.Config) error

Jump to

Keyboard shortcuts

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