hashing

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrInvalidHash in returned by ComparePasswordAndHash if the provided
	// hash isn't in the expected format.
	ErrInvalidHash = utils.Error("argon2id: hash is not in the correct format")

	// ErrIncompatibleVersion is returned by ComparePasswordAndHash if the
	// provided hash was created using a different version of Argon2.
	ErrIncompatibleVersion = utils.Error("argon2id: incompatible version of argon2")
)

Variables

This section is empty.

Functions

func Argon2IdCreateHash

func Argon2IdCreateHash(password string, c Argon2Config) (string, error)

func Argon2IdNeedsRehash

func Argon2IdNeedsRehash(c *Argon2Config) bool

Types

type Argon2Config

type Argon2Config struct {
	Memory      uint32 `json:"memory"`
	Iterations  uint32 `json:"iterations"`
	Parallelism uint8  `json:"parallelism"`
	SaltLength  uint32 `json:"saltLength"`
	KeyLength   uint32 `json:"keyLength"`
}

Argon2Config blueprint-style config struct

func Argon2IdComparePassword

func Argon2IdComparePassword(password, hash string) (bool, *Argon2Config, error)

Argon2ComparePassword Compares password and hash, and returns the hash configto enable re-hashing if necessary

func Argon2IdDecodeHash

func Argon2IdDecodeHash(hash string) (*Argon2Config, []byte, []byte, error)

func NewArgon2IdConfig

func NewArgon2IdConfig() Argon2Config

Jump to

Keyboard shortcuts

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