17 lines
381 B
Go
17 lines
381 B
Go
|
package password
|
||
|
|
||
|
import "github.com/alexedwards/argon2id"
|
||
|
|
||
|
type Argon2id struct {
|
||
|
}
|
||
|
|
||
|
func (a *Argon2id) Create(password string) (hash string, err error) {
|
||
|
hash, err = argon2id.CreateHash(password, argon2id.DefaultParams)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
func (a *Argon2id) Verify(password, hash string) (match bool, err error) {
|
||
|
match, err = argon2id.ComparePasswordAndHash(password, hash)
|
||
|
return
|
||
|
}
|