Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrorInvalidHash indicates that the provided hash does not conform to // any argon2 standard. ErrorInvalidHash = fmt.Errorf("argon2id: invalid hash provided") // ErrorInvalidVersion indicates that the provided has may be an argon hash // but is not an argon2id hash. ErrorInvalidVersion = fmt.Errorf("argon2id: non argon2id hash provided") // ErrorPasswordMismatch indicates that the provided hash and password do // not match. ErrorPasswordMismatch = fmt.Errorf("argon2id: password did not match") )
Functions ¶
func CompareHashAndPassword ¶
CompareHashAndPassword compares a hashed Argon2id password with a possible plaintext equivalent. Returns nil on success, or an error on failure.
func GenerateFromPassword ¶
func GenerateFromPassword(password []byte, p Parameters) ([]byte, error)
GenerateFromPassword takes a password and parameter struct and encodes the password with Argon2id, based on the parameters set in the struct.
Types ¶
type Parameters ¶
Parameters is a collection of parameters that control the output of the hash.
func GetParametersFromHash ¶
func GetParametersFromHash(hash []byte) (Parameters, error)
GetParametersFromHash will read an Argon2id hash and return a parameters object with the parameters that were used to generate the hash.
func NewParameters ¶
NewParameters genreates a new Parameters struct and initializes it with the provided values and a randomly generated salt.
Click to show internal directories.
Click to hide internal directories.