keys/bcrypt/bcrypt.go
func GenerateFromPassword(salt []byte, password []byte, cost int) ([]byte, error) {
	if len(salt) != maxSaltSize {
		return nil, fmt.Errorf("Salt len must be %v", maxSaltSize)
	}
	p, err := newFromPassword(salt, password, cost)
	if err != nil {
		return nil, err
	}
	return p.Hash(), nil
}
func GenerateFromPassword(salt []byte, password []byte, cost int) ([]byte, error) {
	if len(salt) != maxSaltSize {
		return nil, fmt.Errorf("Salt len must be %v", maxSaltSize)
	}
	p, err := newFromPassword(salt, password, cost)
	if err != nil {
		return nil, err
	}
	return p.Hash(), nil
}
func GenerateFromPassword ( salt [ ] byte , password [ ] byte , cost int ) ( [ ] byte , error ) { if len ( salt ) != maxSaltSize { return nil , fmt . Errorf ( " " , maxSaltSize ) } p , err := newFromPassword ( salt , password , cost ) if err != nil { return nil , err } return p . Hash ( ) , nil }
// GenerateFromPassword returns the bcrypt hash of the password at the given
// cost. If the cost given is less than MinCost, the cost will be set to
// DefaultCost, instead. Use CompareHashAndPassword, as defined in this package,
// to compare the returned hashed password with its cleartext version.
GenerateFromPassword returns the bcrypt hash of the password at the given cost . If the cost given is less than MinCost the cost will be set to DefaultCost instead . Use CompareHashAndPassword as defined in this package to compare the returned hashed password with its cleartext version .