What is bcrypt?
bcrypt is a password hashing function designed by Niels Provos and David Mazières, based on the Blowfish cipher. It was introduced in 1999. bcrypt is a key derivation function, which is not suitable for use as a general hash function.
How do use bcrypt?
package main
import (
"fmt"
"golang.org/x/crypto/bcrypt"
)
func main() {
password := "password"
hash, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
if err != nil {
fmt.Println(err)
}
fmt.Println(string(hash))
}