Golang create hash from []string

Hi guys! I am back! I have really big problem right now. I have this code

func Login(w http.ResponseWriter, r *http.Request) {
		mysql_login(r.Form["username"], r.Form["password"])
func mysql_login(username []string, password []string) bool {

	h := sha256.New()
	hash := h.Sum(nil)

	err := mysqlconnection.QueryRow("SELECT username,password FROM users where username = ?", 2).Scan(&username, &password)
	if err != nil {
		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?

It looks like your trying to convert a slice of strings to a byte slice instead of a plain string. Can you use string as your parameters in mysql_login instead of []string?

I have a fix.
Just simply replace




This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.