passwords

package module
v0.0.0-...-4323bc7 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2021 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultHashParams = HashParams{
		HashFunction: "argon2",
		Memory:       32 * 1024,
		Time:         3,
		Threads:      4,
		SaltLength:   32,
		KeyLength:    32,
	}
)

Functions

func VerifyPassword

func VerifyPassword(givenPassword string, comparator *HashResults) (bool, error)

Types

type HashParams

type HashParams struct {
	HashFunction string `json:"hash_function"`
	Memory       uint32 `json:"memory"`
	Time         uint32 `json:"time"`
	Threads      uint8  `json:"threads"`
	SaltLength   uint32 `json:"salt_length"`
	KeyLength    uint32 `json:"key_length"`
}

type HashResults

type HashResults struct {
	Salt   string     `json:"salt"`
	Hash   string     `json:"hash"`
	Params HashParams `json:"params"`
}

func HashPassword

func HashPassword(password string, p *HashParams) (*HashResults, error)

Jump to

Keyboard shortcuts

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