I need to create a way to encrypt my login password on my system, as I have not yet implemented this security and I have no idea how to do this.
So how could I create this encryption and compare it to the login time and see if it's right? That is, create that hash to confuse the attacker (if I have a person using While Shark to try to intercept my password)?
What is the best way (base 64, MD5, RSA, among other ways)?
Here is the code for my controller that I use to login and compare the login and password in the database:
AuthenticationController
[HttpPost]
public ActionResult Index(String Login, String Senha)
{
//verificando login pelo usuario do banco de dados ...
Usuario login = db.Usuarios.Where(x => x.Login == Login && x.Senha == Senha).FirstOrDefault();
if (login != null)
{
FormsAuthentication.SetAuthCookie(login.Nome.ToString(), false);
Session.Add(".PermissionCookie", login.Perfil);
Session.Add("UsuarioID", login.UsuarioID);
return RedirectToAction("Index", "Home"); //pagina padrao para todos os usuarios...
}
return RedirectToAction("Index");
}