Hi guys! I am back! I have really big problem right now. I have this code
func Login(w http.ResponseWriter, r *http.Request) {
r.ParseForm()
mysql_login(r.Form["username"], r.Form["password"])
}
func mysql_login(username []string, password []string) bool {
h := sha256.New()
h.Write([]byte(password))
hash := h.Sum(nil)
err := mysqlconnection.QueryRow("SELECT username,password FROM users where username = ?", 2).Scan(&username, &password)
if err != nil {
panic(err.Error())
return false
} else {
return true
}
}
i am trying to make a sha256 hash from password []string, but it wont work.
i get this error:
cannot convert password (type []string) to type []byte
is there anyway how to create the hash?