Documentation ¶
Overview ¶
Package hash is build to support multiple hashing algorithms with different parameters across projects.
Index ¶
Constants ¶
View Source
const ( BcryptMinCost = bcrypt.MinCost BcryptMaxCost = bcrypt.MaxCost BcryptDefaultCost = bcrypt.DefaultCost )
Variables ¶
View Source
var ( ErrBcryptCostMinValue = errors.InvalidArgumentErrorf("bcrypt cost myst be a minimum of %d", BcryptMinCost) ErrBcryptCostMaxValue = errors.InvalidArgumentErrorf("bcrypt cost myst be a maximum of %d", BcryptMaxCost) )
View Source
var DefaultBcrypt = &model.BcryptHashingConfig{ Cost: int32(BcryptDefaultCost), }
View Source
var DefaultScrypt = &model.ScryptHashingConfig{
SignerKey: "",
SaltSeparator: "Bw==",
Rounds: 8,
MemCost: 14,
P: 1,
KeyLen: 32,
}
Functions ¶
Types ¶
type Hash ¶
type Hash interface { Generate(password string) (*model.HashingInstance, error) Compare(password string, hashModel *model.HashingInstance) error }
func New ¶
func New(config *model.HashingConfig) Hash
Click to show internal directories.
Click to hide internal directories.