Documentation ¶
Index ¶
Constants ¶
View Source
const ( MEMORY uint32 = 64 * 1024 ITER uint32 = 1 PARALLEL uint8 = 2 SALT_LEN uint32 = 16 KEY_LEN uint32 = 32 )
Default Argon2Configs
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Argon2Configs ¶
type Argon2Configs struct { Memory uint32 // The amount of memory to use for the operation, in KiB Iterations uint32 // The number of iterations to perform Parallelism uint8 // The number of threads to use to compute the hash SaltLength uint32 // 16 bytes is recommended for password hashing. Salt SHOULD be unique for each password KeyLength uint32 // The length of the key to use (in bytes) }
Params are the parameters to use to create an argon2id hash See https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-argon2-04#section-3.1 for more info
func NewArgon2id ¶ added in v1.0.1
func NewArgon2id() *Argon2Configs
NewArgon2id returns a new pwd Argon2id instance
func (*Argon2Configs) CheckPasswordHash ¶ added in v1.0.1
func (agc *Argon2Configs) CheckPasswordHash(password, hash string) (bool, error)
CheckPasswordHash returns true if the password hash matches the password
func (*Argon2Configs) DecodeHashPassword ¶ added in v1.0.1
func (agc *Argon2Configs) DecodeHashPassword(hash string) ([]byte, []byte, error)
DecodeHashPassword decodes the password hash and returns the salt and the key
func (*Argon2Configs) HashAndSalt ¶ added in v1.0.1
func (agc *Argon2Configs) HashAndSalt(password string) (string, error)
HashAndSalt generates a hashed password using the given password and parameters and returns the hash
func (*Argon2Configs) SetArgon2Configs ¶ added in v1.0.1
func (agc *Argon2Configs) SetArgon2Configs(conf *Argon2Configs)
SetArgon2Configs sets the custom Argon2Configs to use for Argon2 hashing.
Click to show internal directories.
Click to hide internal directories.