Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareHash ¶
CompareHash compares a password and the salt with the hash. return if the password is a match for the hash
Example ¶
pass := "pass" hash, err := Hash(pass) if err != nil { // Use a better handler panic(err) } fmt.Println(hash) CompareHash(hash, pass) // true CompareHash(hash, "not pass") // false
Output:
func GenerateKey ¶
GenerateKey generate a n th long key
Example ¶
fmt.Println(GenerateKey(10))
Output: &[l8+P$w\B
func Hash ¶
Hash hashes the password with the salt and return the hash as a string by using the bcrypt algorithm.
Example ¶
pass := "pass" hash, err := Hash(pass) if err != nil { // Use a better handler panic(err) } fmt.Println(hash) CompareHash(hash, pass) // true CompareHash(hash, "not pass") // false
Output:
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.