diff options
Diffstat (limited to 'auth/hashpass.go')
-rw-r--r-- | auth/hashpass.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/auth/hashpass.go b/auth/hashpass.go new file mode 100644 index 0000000..4e5041a --- /dev/null +++ b/auth/hashpass.go @@ -0,0 +1,13 @@ +package auth + +import ( + "golang.org/x/crypto/bcrypt" +) + +// hashPass takes a string as input and returns the hash of the +// password. +func hashPass(password string) (string, error) { + // 10 is the default cost. + bytes, err := bcrypt.GenerateFromPassword([]byte(password), 10) + return string(bytes), err +} |