/// <summary>
 /// tries to log the user in
 /// </summary>
 /// <param name="username">the username of the user</param>
 /// <param name="password">the password for the user</param>
 /// <returns>if it was able to login</returns>
 public bool Login(string username, string password)
 {
     if (password.Length > 5)
     {
         byte[] passwordByte = Encoding.UTF8.GetBytes(password);
         User user = dataManager.GetUser(username);
         if (user.Password != null)
         {
             byte[] salt = Convert.FromBase64String(user.Salt);
             password = Convert.ToBase64String(hashing.ComputeMAC(passwordByte, salt));
             return hashing.Validate(Convert.FromBase64String(user.Password), Convert.FromBase64String(password));
         }
     }
     return false;
 }
 /// <summary>
 /// Validates user inputs with the inputed MAC
 /// </summary>
 public void Validate(object obj = null)
 {
     try
     {
         if (VMAC != "")
         {
             byte[] userMAC = new byte[0];
             if (vAscii)
             {
                 // Converts ascii to byte array
                 userMAC = Encoding.ASCII.GetBytes(VMAC);
             }
             else if (vBase64)
             {
                 // Converts base64 to byte array
                 userMAC = Convert.FromBase64String(VMAC);
             }
             else
             {
                 // Converts hex string to byte array
                 string[] hexValuesSplit = VMAC.Split('-');
                 userMAC = new byte[hexValuesSplit.Length];
                 for (int i = 0; i < hexValuesSplit.Length; i++)
                 {
                     userMAC[i] = Convert.ToByte(hexValuesSplit[i], 16);
                 }
             }
             // Validates the inputed mac with the generated mac
             Valid = hashing.Validate(hashed, userMAC);
         }
     }
     catch
     {
         Valid = false;
     }
 }