aboutsummaryrefslogtreecommitdiff
path: root/hotline/account.go
diff options
context:
space:
mode:
authorJeff Halter <868228+jhalter@users.noreply.github.com>2022-07-03 15:36:17 -0700
committerJeff Halter <868228+jhalter@users.noreply.github.com>2022-07-03 15:36:17 -0700
commit69af8ddbdff8e6d0dd551e9bdc72284469a86fc0 (patch)
treebd21da2c1c5f7f4573f417b1cd69ff5dfedf2dee /hotline/account.go
parent854a92fc2755ace61c405df335ddf69b02a3d932 (diff)
Minor cleanup
Diffstat (limited to 'hotline/account.go')
-rw-r--r--hotline/account.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/hotline/account.go b/hotline/account.go
index a680861..9a0fb7d 100644
--- a/hotline/account.go
+++ b/hotline/account.go
@@ -3,6 +3,7 @@ package hotline
import (
"encoding/binary"
"golang.org/x/crypto/bcrypt"
+ "log"
)
const GuestAccount = "guest" // default account used when no login is provided for a connection
@@ -37,3 +38,13 @@ func (a *Account) Read(p []byte) (n int, err error) {
return len(p), nil
}
+
+// hashAndSalt generates a password hash from a users obfuscated plaintext password
+func hashAndSalt(pwd []byte) string {
+ hash, err := bcrypt.GenerateFromPassword(pwd, bcrypt.MinCost)
+ if err != nil {
+ log.Println(err)
+ }
+
+ return string(hash)
+}