hashing

package
v0.0.0-...-1b39580 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidHash         = errors.New("argon2id: hash is not in the correct format")
	ErrIncompatibleVariant = errors.New("argon2id: incompatible variant of argon2")
	ErrIncompatibleVersion = errors.New("argon2id: incompatible version of argon2")
)
View Source
var DefaultParams = &Params{
	Memory:      64 * 1024,
	Iterations:  4,
	Parallelism: 4,
	SaltLength:  16,
	KeyLength:   32,
}

Functions

func Argon2ID

func Argon2ID(password string) (hash string, err error)

func Argon2IDComparePasswordAndHash

func Argon2IDComparePasswordAndHash(password, hash string) (match bool, err error)

func CheckPasswordHash

func CheckPasswordHash(password, hash string) bool

func HashPassword

func HashPassword(password string) (string, error)

func Validate

func Validate(password string, PasswordConfirm string) error

Types

type MismatchError

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

func (MismatchError) Error

func (m MismatchError) Error() string

type Params

type Params struct {
	Memory      uint32
	Iterations  uint32
	Parallelism uint8
	SaltLength  uint32
	KeyLength   uint32
}

func CheckHash

func CheckHash(password, hash string) (match bool, params *Params, err error)

func DecodeHash

func DecodeHash(hash string) (params *Params, salt, key []byte, err error)

type ValidationError

type ValidationError struct {
	Message string
	Field   string
}

func (*ValidationError) Error

func (ve *ValidationError) Error() string

Jump to

Keyboard shortcuts

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