argon2id

package module
v0.0.0-...-32084b0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2024 License: BSD-3-Clause Imports: 5 Imported by: 0

README

Small wrapper around the argon2id class that appends the used parameters to the calculated hash. This makes it possible to change the parameters without effecting previously stored hashes.

Example:

opts := Options{
	Memory:   64 * 1024,
	Time:     1,
	Threads:  2,
	KeySize:  32,
	SaltSize: 10,
}

hash, _ := argon2.Hash(opts, []byte("password"))
ok, _ := argon2.Verify([]byte("password"), hash)
fmt.Println(hash, ok)

Documentation

Overview

Small wrapper around the argon2id class that appends the used parameters to the calculated hash. This makes it possible to change the parameters without effecting previously stored hashes.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnsupported is returned when the hash is created by a newer version of this library
	ErrUnsupported = errors.New("argon2id: unsupported hash version")

	// ErrHashLength is returned when the hash has an invalid length
	ErrHashLength = errors.New("argon2id: hash has an invalid length")
)

Functions

func Compute

func Compute(o Options, input []byte) ([]byte, error)

Compute calculates an argon2id hash for the given options and input

func Verify

func Verify(input, hash []byte) (bool, error)

Verify compares the given input with the given hash

Types

type Options

type Options struct {
	KeySize  uint32
	SaltSize uint8
	Time     uint32
	Memory   uint32
	Threads  uint8
}

Options contains the Argon2id hashing parameters

Jump to

Keyboard shortcuts

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