argon2

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2020 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package argon2 implements a Django compatible Argon2 algorithm.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrHashComponentUnreadable = errors.New("unchained/argon2: unreadable component in hashed password")
	ErrHashComponentMismatch   = errors.New("unchained/argon2: hashed password components mismatch")
	ErrAlgorithmMismatch       = errors.New("unchained/argon2: algorithm mismatch")
	ErrIncompatibleVersion     = errors.New("unchained/argon2: incompatible version")
)

Errors returned by Argon2Hasher.

Functions

This section is empty.

Types

type Argon2Hasher

type Argon2Hasher struct {
	// Algorithm identifier.
	Algorithm string
	// Defines the amount of computation time, given in number of iterations.
	Time uint32
	// Defines the memory usage (KiB).
	Memory uint32
	// Defines the number of parallel threads.
	Threads uint8
	// Defines the length of the hash in bytes.
	Length uint32
}

Argon2Hasher implements Argon2i password hasher.

func NewArgon2Hasher

func NewArgon2Hasher() *Argon2Hasher

NewArgon2Hasher secures password hashing using the argon2 algorithm.

func (*Argon2Hasher) Encode

func (h *Argon2Hasher) Encode(password string, salt string) (string, error)

Encode turns a plain-text password into a hash.

func (*Argon2Hasher) Verify

func (h *Argon2Hasher) Verify(password string, encoded string) (bool, error)

Verify if a plain-text password matches the encoded digest.

Jump to

Keyboard shortcuts

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