Documentation ¶
Index ¶
- Variables
- func EncodeArgon2(hash []byte, salt []byte, p *Argon2Params) (string, error)
- func HashArgon2(password string, p *Argon2Params) ([]byte, []byte, error)
- func HashArgon2Raw(clear []byte, salt []byte, p *Argon2Params) ([]byte, error)
- func SecureSalt(length uint32) ([]byte, error)
- func VerifyArgon2(password string, encodedHash string) (bool, error)
- type Argon2Algorithm
- type Argon2Params
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func EncodeArgon2 ¶
func EncodeArgon2(hash []byte, salt []byte, p *Argon2Params) (string, error)
EncodeArgon2 encodes a given Argon2 hash and salt returns encoded hash or error
func HashArgon2 ¶
func HashArgon2(password string, p *Argon2Params) ([]byte, []byte, error)
HashArgon2 hashes a password using the Argon2 implementation returns the hashed key and salt or error
func HashArgon2Raw ¶
func HashArgon2Raw(clear []byte, salt []byte, p *Argon2Params) ([]byte, error)
HashArgon2Raw generates a hash using the specified salt and params using argon2
This function doesn't generate its own secure salt
returns hash or error
func SecureSalt ¶
SecureSalt generates a secure salt with given length using crypto/rand package returns salt or error
Types ¶
type Argon2Algorithm ¶
type Argon2Algorithm uint8
Argon2Algorithm represents the algorithm enum type
const ( AlgorithmArgon2id Argon2Algorithm = iota AlgorithmArgon2i )
Algorithm enum const for choosing either argon2i or argon2id implementation for password hashing
type Argon2Params ¶
type Argon2Params struct { Algorithm Argon2Algorithm SaltLength uint32 KeyLength uint32 Time uint32 Memory uint32 Threads uint8 // contains filtered or unexported fields }
Argon2Params setting struct This is used to set the used argon2 params which will be used during key derivation process
func DecodeArgon2 ¶
func DecodeArgon2(enc string) ([]byte, []byte, *Argon2Params, error)
DecodeArgon2 decodes a given Argon2 bas64 string returns decoded hash, salt and params or error