package shared import ( "fmt" "golang.org/x/crypto/bcrypt" "log/slog" ) func HashPassword(password string) []byte { passwordbytes := []byte(password) // Hashing the password with the default cost of 10 passwordhash, err := bcrypt.GenerateFromPassword(passwordbytes, bcrypt.DefaultCost) if err != nil { slog.Error("Can't hash password") } fmt.Println(fmt.Sprintf("Hash: %v", passwordhash)) fmt.Println(fmt.Sprintf("Hashlength: %v", len(passwordhash))) return passwordhash }