Encrypt passwords with Go
Go already has many helpful packages from the start. One of them is the bcrypt package with which e.g. will encrypt passwords securely.
We pass our password to the function GenerateFromPassword(byte(pw), 2) as a slice of byte. The second argument is the cost for the encryption as an integer. The higher the costs the longer the encryption will take. The encryption will also be more secure if calculated with a higher cost value. If we pass a 0 bcrypt will use a standard value for the cost.
Pretty easy so far 😊