hash

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2021 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Password salt number of bytes.
	ARGON2_SALT_LEN = 16

	// Argon2 time parameter.
	ARGON2_TIME = 1

	// Argon2 memory parameter (in KiB).
	ARGON2_MEMORY = 64 * 1024

	// Argon2 thread parameter.
	ARGON2_THREADS = 4

	// Length of the hashed key.
	ARGON2_KEY_LEN = 32

	// Stored password format string.
	// Format: "<algorithm>$<algorithm_ver>$<time>$<memory>$<threads>$<salt>$<hash>"
	ARGON2_FORMAT = "argon2id$%d$%d$%d$%d$%s$%s"

	// Separator between parameters.
	ARGON2_FORMAT_SEP = "$"

	// How many parameters are stored in the ARGON2_FORMAT
	// argon2id + version + time + memory + threads + salt + hash
	ARGON2_FORMAT_COUNT = 7
)

Variables

This section is empty.

Functions

func CmpPassword

func CmpPassword(encoded, plaintext string) (bool, error)

Compare an encoded password using the encoding described in ARGON2_FORMAT with a plaintext password.

func Password

func Password(plaintext string) (string, error)

Generate an argon2 hash of the provided plaintext password using the parameters described above.

Types

This section is empty.

Jump to

Keyboard shortcuts

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