Initial commit

This commit is contained in:
Lizandro Guarnizo
2025-02-06 14:22:29 -05:00
commit 6d8f1bcd6f
452 changed files with 250835 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
package config
import (
"github.com/alexedwards/argon2id"
)
type Hash struct {
// Argon2id configuration
Params *argon2id.Params
}
func (d *Hash) Create(password string) (hash string, err error) {
if d.Params == nil {
d.Params = argon2id.DefaultParams
}
return argon2id.CreateHash(password, d.Params)
}
func (d *Hash) Match(password string, hash string) (match bool, err error) {
if d.Params == nil {
d.Params = argon2id.DefaultParams
}
return argon2id.ComparePasswordAndHash(password, hash)
}