Argon2 utils
About
Utils to encrypt passwords using argon2
Usages
Hash password
password := 'qwerty@123'
encoder, _ := argon2.NewEncoder()
hashedString, err = encoder.HashString(randomString)
if err != nil {
}
Compare password with hashed string
decoder, _ := argon2.NewDecoder()
match, err := decoder.CompareStringToHash(password, hashedString)
if err != nil {
}
Configure encoder or decoder options
Note that encoder and decoder inherited from the same base struct (argon2.Options).
You can use the same argon2.OptFunc
slice to configure both encoder and decoder.
encoder, options := argon2.NewEncoder(
SetMemory(64 * 1024),
SetParallelism(4),
SetKeyLength(32),
SetSaltLength(32),
SetIterations(4),
)
Contributions
Euphoria Laxis GitHub
License
This project is under MIT License