argon2

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2021 License: MIT Imports: 9 Imported by: 0

README

Go Argon2

Go Reference

Reexports of the golang.org/x/crypto/argon2 with their bcrypt API. The default parameters follow best practice.

Download/Install

The easiest way to install is to run go get -u github.com/mu-io/go-argon2. You can also manually git clone the repository to $GOPATH/src/github.com/mu-io/go-argon2.

Documentation

Overview

Package argon2 reexports golang.org/x/crypto/argon2 with their bcrypt API. The default parameters follow best practice.

Index

Constants

View Source
const (
	Iterations  uint8  = 10 // See https://eprint.iacr.org/2016/759.pdf
	TimeCost    uint32 = 3
	MemoryCost  uint32 = 32 * 1024
	Threads     uint8  = 2
	MaxTagLen   uint32 = 32
	MaxSaltSize uint32 = 16
)

Default parameters for all functions

Variables

View Source
var ErrHashTooShort = errors.New("mu-io/go-argon2: hashedSecret too short to be a argon2ed password")

ErrHashTooShort - The error returned from CompareHashAndPassword when a hash is too short to be a argon2 hash.

View Source
var ErrMismatchedHashAndPassword = errors.New("mu-io/go-argon2: hashedPassword is not the hash of the given password")

ErrMismatchedHashAndPassword - The error returned from CompareHashAndPassword when a password and hash do not match.

Functions

func CompareHashAndPassword

func CompareHashAndPassword(hashedPassword, password []byte) error

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

func GenerateFromPassword

func GenerateFromPassword(variant string, password []byte) ([]byte, error)

GenerateFromPassword returns the argon2 hash of the password.

Types

type HashVariantNotSupportedError

type HashVariantNotSupportedError []byte

HashVariantNotSupportedError - The error returned from CompareHashAndPassword when a hash was created with a argon2 variant not supported.

func (HashVariantNotSupportedError) Error

type HashVersionNotSupportedError

type HashVersionNotSupportedError uint8

HashVersionNotSupportedError - The error returned from CompareHashAndPassword when a hash was created with a argon2 version newer than this implementation.

func (HashVersionNotSupportedError) Error

type InvalidHashPrefixError

type InvalidHashPrefixError byte

InvalidHashPrefixError - The error returned from CompareHashAndPassword when a hash starts with something other than '$'

func (InvalidHashPrefixError) Error

func (ih InvalidHashPrefixError) Error() string

Jump to

Keyboard shortcuts

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