Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BcryptHasher ¶
type BcryptHasher struct { }
func NewBcryptHasher ¶
func NewBcryptHasher() *BcryptHasher
NewBcryptHasher returns a new bcrypt hasher.
func (*BcryptHasher) Check ¶
func (b *BcryptHasher) Check(value, hashedValue string) bool
Check returns true if the value matches the hashed value.
func (*BcryptHasher) Make ¶
func (b *BcryptHasher) Make(value string) (string, error)
Make returns the hashed value.
func (*BcryptHasher) MakeWithCost ¶
func (b *BcryptHasher) MakeWithCost(value string, cost int) (string, error)
MakeWithCost returns the hashed value with the given cost.
func (*BcryptHasher) MustMake ¶
func (b *BcryptHasher) MustMake(value string) string
MustMake returns the hashed value.
type Hasher ¶
type Hasher interface { // Make a hash value from the given value. Make(value string) (string, error) // MustMake a hash value from the given value. // if an error occurs, it will panic. MustMake(value string) string // Check the given value matches the given hashed value. // if Make() is error, it will return false. Check(value, hashedValue string) bool }
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
NewManager creates a new hashing manager instance. config example:
config := &Config{ Driver: "bcrypt", }
type Md5Hasher ¶
type Md5Hasher struct { }
type Sha1Hasher ¶ added in v1.1.0
type Sha1Hasher struct { }
func NewSha1Hasher ¶ added in v1.1.0
func NewSha1Hasher() *Sha1Hasher
NewSha1Hasher creates a new sha1 hasher instance.
func (*Sha1Hasher) Check ¶ added in v1.1.0
func (s *Sha1Hasher) Check(value, hashedValue string) bool
Check checks the given value and hashed value.
func (*Sha1Hasher) Make ¶ added in v1.1.0
func (s *Sha1Hasher) Make(value string) (string, error)
Make generates a new hashed value.
func (*Sha1Hasher) MustMake ¶ added in v1.1.0
func (s *Sha1Hasher) MustMake(value string) string
MustMake generates a new hashed value.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.