Initial commit

This commit is contained in:
2026-06-03 01:52:56 +02:00
commit 190134af7b
17 changed files with 772 additions and 0 deletions

12
auth/password.go Normal file
View File

@@ -0,0 +1,12 @@
package auth
import "golang.org/x/crypto/bcrypt"
func HashPassword(password string) (string, error) {
bytes, err := bcrypt.GenerateFromPassword([]byte(password), 14)
return string(bytes), err
}
func CheckPasswordHash(password, hash string) bool {
err := bcrypt.CompareHashAndPassword([]byte(hash), []byte(password))
return err == nil
}