argon2id

package
v0.0.1-alpha Latest Latest
Warning

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

Go to latest
Published: May 15, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package argon2id provides functions to deal with argon2id password protection.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidHash         = errors.New("the encoded hash is not in the correct format")
	ErrIncompatibleVersion = errors.New("incompatible version of argon2")
	ErrPasswordNotMatch    = errors.New("passwords do not match")
)

Functions

func CompareHashAndPassword

func CompareHashAndPassword(hash string, pass []byte) error

CompareHashAndPassword compares a argon2id hashed password with its possible plaintext equivalent. Returns nil on success, or an error on failure.

func GenerateFromPassword

func GenerateFromPassword(pass []byte, p *Params) (string, error)

GenerateFromPassword generates the string representation of argon2id from the given password and parameters. Returns the string representation with nil error when successful. On failure, it returns empty string with non-nil error.

Types

type Params

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

Params stores the argon2 parameters.

Jump to

Keyboard shortcuts

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