summary refs log tree commit diff stats
path: root/password/hash.go
blob: 3dd949b7a67e71b5dd3e422602705924f4816c7f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
package password

import "golang.org/x/crypto/bcrypt"

// Hash takes a string as input and returns the hash of the
// password.
func Hash(password string) (string, error) {
	// 10 is the default cost.
	out, err := bcrypt.GenerateFromPassword([]byte(password), 10)
	return string(out), err
}