auth

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2026 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package auth provides password hashing and verification utilities using the argon2id algorithm for secure credential storage.

Index

Constants

View Source
const (
	Argon2Time    = 1
	Argon2Memory  = 64 * 1024 // 64 MB
	Argon2Threads = 4
	Argon2KeyLen  = 32
	Argon2SaltLen = 16
)

Argon2 parameters

Variables

This section is empty.

Functions

func CheckPassword

func CheckPassword(password, encodedHash string) (bool, error)

CheckPassword verifies a password against an Argon2id hash.

func HashArgon2 added in v0.1.0

func HashArgon2(input string) (string, error)

HashArgon2 creates an Argon2id hash of the input string. Returns encoded hash in format: $argon2id$v=19$m=65536,t=1,p=4$salt$hash

func HashPassword

func HashPassword(password string) (string, error)

HashPassword creates an Argon2id hash of the password.

func VerifyArgon2 added in v0.1.0

func VerifyArgon2(input, encodedHash string) (bool, error)

VerifyArgon2 verifies an input string against an Argon2id hash. Uses constant-time comparison to prevent timing attacks.

Types

This section is empty.

Jump to

Keyboard shortcuts

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