Documentation ¶
Overview ¶
Package hasher provide functions for coverting given plain-text password into a hash and validating plain-text password against given hash
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckPasswordHash ¶
Receives string password and hash and returns true if hashed password is equal to provided hash
Example ¶
myPassword := "myPassword" fmt.Println(CheckPasswordHash(myPassword, "$2a$14$fo41Lff9uGg3Bmm6OZ1g9uZGsZALyX.8GGwG/Gd0zmngNBM.4RKbG")) fmt.Println(CheckPasswordHash(myPassword, "wrong_hash"))
Output: true false
func HashPassword ¶
Receives string password as input and returns its string hash or error if any problems occur
Example ¶
myPassword := "myPassword" hash, _ := HashPassword(myPassword) fmt.Println(myPassword) fmt.Println(hash)
Output: myPassword $2a$14$fo41Lff9uGg3Bmm6OZ1g9uZGsZALyX.8GGwG/Gd0zmngNBM.4RKbG
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.