pfug/hashing.go
2023-11-04 01:44:04 +01:00

26 lines
397 B
Go

package pfug
import (
"encoding/base64"
"golang.org/x/crypto/argon2"
)
func generatePasswordHash(password string, salt string) string {
const time uint32 = 4
const threads uint8 = 4
const memory uint32 = 64 * 1024
const keyLen uint32 = 32
dk := argon2.IDKey(
[]byte(password),
[]byte(salt),
time,
memory,
threads,
keyLen,
)
return base64.StdEncoding.EncodeToString(dk)
}