public bool IsValid(string username, string password, string email, DynamicDb db) { byte[] bytes = Encoding.UTF8.GetBytes(password); SHA256Managed hashstring = new SHA256Managed(); byte[] hash = hashstring.ComputeHash(bytes); string hashString = string.Empty; foreach (byte x in hash) { hashString += String.Format("{0:x2}", x); } try { var user = db.RunProcedure<Composites.User>("InsertUser", new { username = username, password = hashString, email = email, userdata = "" }); return user != null; } catch (Exception ex) { return false; } }