package crypto import ( "fmt" "golang.org/x/crypto/bcrypt" ) func Test() { hash("test") hash("test") hash("test1") } func hash(pwd string) { hash, err := bcrypt.GenerateFromPassword([]byte(pwd), bcrypt.DefaultCost) if err != nil { panic(err) } fmt.Printf("Password hash: %x\n", hash) }