removed 'internal' directory

This commit is contained in:
Bronku 2025-06-19 21:48:06 +02:00
parent 8c200a5a6c
commit 65709049d7
42 changed files with 35 additions and 44 deletions

21
crypto/crypto.go Normal file
View file

@ -0,0 +1,21 @@
package crypto
import (
"crypto/rand"
"encoding/base64"
"log"
"golang.org/x/crypto/argon2"
)
func PasswordHash(password, salt string) string {
return string(argon2.Key([]byte(password), []byte(salt), 3, 32*1024, 4, 32))
}
func GenerateKey() string {
key := [32]byte{}
if _, err := rand.Read(key[:]); err != nil {
log.Fatal("can't generate a valid key", err)
}
return base64.StdEncoding.EncodeToString(key[:])
}