password

package
v0.0.0-...-46021d3 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//ErrInvalidHash is the error message for invalid hash
	ErrInvalidHash = errors.New("the encoded hash is not in the correct format")
	//ErrIncompatibleVersion is the error message for an incompatible version
	ErrIncompatibleVersion = errors.New("incompatible version of argon2")
)

Functions

func ComparePasswordAndHash

func ComparePasswordAndHash(password, encodedHash string) (match bool, err error)

ComparePasswordAndHash compare a password and a hash

func GenerateFromPassword

func GenerateFromPassword(password string) (encodedHash string, err error)

GenerateFromPassword generates a hash from a password

func GenerateRandomBytes

func GenerateRandomBytes(n uint32) ([]byte, error)

GenerateRandomBytes generates random bytes

Types

type Params

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

Params is a params model

func DecodeHash

func DecodeHash(encodedHash string) (p *Params, salt, hash []byte, err error)

DecodeHash is used to decode a hash

Jump to

Keyboard shortcuts

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