Documentation
¶
Index ¶
Constants ¶
Variables ¶
View Source
var ( ErrInvalidHash = errors.New("the encoded hash is not in the correct format") ErrIncompatibleVersion = errors.New("incompatible version of argon2") ErrMismatchedHashAndPassword = errors.New("passwords do not match") )
View Source
var Argon2CPUParallelism = uint8(runtime.NumCPU() * 2)
Functions ¶
This section is empty.
Types ¶
type Argon2 ¶
type Argon2 struct {
// contains filtered or unexported fields
}
func NewHasherArgon2 ¶
func NewHasherArgon2(c HasherArgon2Config) *Argon2
type HashProvider ¶
type HashProvider interface {
Hasher() Hasher
}
type Hasher ¶
type Hasher interface { // Compare a password to a hash and return nil if they match or an error otherwise. Compare(ctx context.Context, password []byte, hash []byte) error // Generate returns a hash derived from the password or an error if the hash method failed. Generate(ctx context.Context, password []byte) ([]byte, error) }
Hasher provides methods for generating and comparing password hashes.
type HasherArgon2Config ¶
type HasherArgon2Config struct { Memory uint32 `json:"memory" required:"true" default:"4194304"` Iterations uint32 `json:"iterations" required:"true" default:"4"` Parallelism uint8 `json:"parallelism" required:"true" default:"8"` SaltLength uint32 `json:"salt_length" required:"true" default:"16" split_words:"true"` KeyLength uint32 `json:"key_length" required:"true" default:"32" split_words:"true"` }
Click to show internal directories.
Click to hide internal directories.