argon2id

package
v0.0.0-...-4ca576a Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidHash in returned by ComparePasswordAndHash if the provided
	// hash isn't in the expected format.
	InvalidHashError = errors.New("argon2id: incorrect_hash_format")

	// ErrIncompatibleVersion in returned by ComparePasswordAndHash if the
	// provided hash was created using a different version of Argon2.
	IncompatibleVersionError = errors.New("argon2id: incompatible_version")
)
View Source
var DefaultConfig = &Config{
	memory:      64 * 1024,
	iterations:  1,
	parallelism: 4,
	saltLength:  16,
	keyLength:   32,
}

GetPasswordConfig Returns the configurations

Functions

func ComparePasswordHash

func ComparePasswordHash(password string, hash string) (bool, error)

ComparePasswordHash take password and hash to compare them both And determine if the password is valid or not.

func GeneratePasswordHash

func GeneratePasswordHash(password string, c *Config) (string, error)

GeneratePasswordHash takes plaintext password and generate hash The hashed string can be used to be saved in Database

Types

type Config

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

Jump to

Keyboard shortcuts

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