Library and cli tool for password hashing
The hashing algorithm is Argon2id.
The result is:
- Hash: hexadecimal string with length of 64
- Salt: hexadecimal string with length of 32
- Version: int
go get -u salif.eu/go/hasher
import (
"salif.eu/go/hasher"
)
var password = "password"
var hash, salt, version = hasher.Hash(password)
// save hash, salt and version to database
var password = "password"
// get hash, salt and version from database
var ok = hasher.Verify(password, hash, salt, version)
if ok {
// The password is correct
}
go get -u salif.eu/go/hasher/cmd/hasher
echo -n "password" | hasher
hasher "filename"
echo -n "password" | hasher "hash" "salt" 2
hasher "filename" "hash" "salt" 2
This library is licensed under the MIT license