argon2

package
v0.3.23 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package argon2 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

DefaultConfig returns the default configuration for Argon2

func DefaultParams

func DefaultParams() interfaces.Params

func NewArgon2 added in v0.3.18

func NewArgon2(algType types.Type, config *types.Config) (interfaces.Cryptographic, error)

NewArgon2 creates a new Argon2 crypto instance

func NewArgon2i added in v0.3.18

func NewArgon2i(cfg *types.Config) (interfaces.Cryptographic, error)

func NewArgon2id added in v0.3.18

func NewArgon2id(cfg *types.Config) (interfaces.Cryptographic, error)

func NewDefaultArgon2 added in v0.3.18

func NewDefaultArgon2(config *types.Config) (interfaces.Cryptographic, error)

func ResolveType added in v0.3.18

func ResolveType(p types.Type) (types.Type, error)

Types

type Argon2

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

Argon2 implements the Argon2 hashing algorithm

func (*Argon2) Hash

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

Hash implements the hash method

func (*Argon2) HashWithSalt

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

HashWithSalt implements the hash with salt method

func (*Argon2) Type

func (c *Argon2) Type() types.Type

func (*Argon2) Verify

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

Verify implements the verify method

type KeyFunc added in v0.3.18

type KeyFunc func(password []byte, salt []byte, time uint32, memory uint32, threads uint8, keyLen uint32) []byte

func ParseKeyFunc added in v0.3.18

func ParseKeyFunc(algType types.Type) KeyFunc

type Params

type Params struct {
	TimeCost   uint32
	MemoryCost uint32
	Threads    uint8
	KeyLength  uint32
}

Params represents parameters for Argon2 algorithm

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) String

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

ToMap converts Params to a 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