password_hashing

package
v0.0.0-...-8bc3ba8 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMemory      uint32 = 15
	DefaultTime        uint32 = 2
	DefaultParallelism uint8  = 1
	DefaultKeyLen      uint32 = 32
	DefaultSaltLen     uint32 = 16
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Argon2idKeyDerivator

type Argon2idKeyDerivator struct {
	Params *Argon2idParams
	// contains filtered or unexported fields
}

func NewArgon2idKeyDerivator

func NewArgon2idKeyDerivator(maxTotalMemMiB uint32, params *Argon2idParams, updateParams bool) *Argon2idKeyDerivator

func (*Argon2idKeyDerivator) CheckPassword

func (kd *Argon2idKeyDerivator) CheckPassword(ctx context.Context, pwHash, pwToCheck string) (needsUpdate, ok bool, err error)

func (*Argon2idKeyDerivator) GeneratePasswordHash

func (kd *Argon2idKeyDerivator) GeneratePasswordHash(ctx context.Context, pw string) (string, error)

GeneratePasswordHash derives a key from the password, salt, and cost parameters using Argon2id returning the standard encoded representation of the hashed password https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-argon2-03

type Argon2idParams

type Argon2idParams struct {
	Memory  uint32 // the memory parameter specifies the size of the memory in KiB
	Time    uint32 // the time parameter specifies the number of passes over the memory
	Threads uint8  // the threads parameter specifies the number of threads and can be adjusted to the numbers of available CPUs
	KeyLen  uint32 // the length of the resulting derived key in byte
	SaltLen uint32 // the length of the random salt in byte
}

func GetArgon2idParams

func GetArgon2idParams(memMiB, time uint32, threads uint8, keyLen, saltLen uint32) *Argon2idParams

func GetDefaultArgon2idParams

func GetDefaultArgon2idParams() *Argon2idParams

Jump to

Keyboard shortcuts

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