package main import ( "fmt" "log" "os" "strconv" "golang.org/x/crypto/bcrypt" ) func main() { password := []byte(os.Args[1]) cost, err := strconv.ParseInt(os.Args[2], 10, 0) if err != nil { log.Fatalln("Failed to parse cost: ", err) } hash, err := bcrypt.GenerateFromPassword(password, int(cost)) if err != nil { log.Fatalln("Failed to hash: ", err) } fmt.Println(string(hash)) }