Rajesh Gami

Rajesh Gami

  • 79
  • 24.4k
  • 1.3m

Create MD5 Password Encryption in MVC

Apr 4 2018 2:23 AM
How to generate MD5 Encrypted passeword in MVC.
 
i dont want to generate password like : 4DE53544234ADFFBB421ED60FFCFB835
 
here is my code:
  1. MD5 md5 = new MD5CryptoServiceProvider();  
  2. //Byte[] originalBytes = ASCIIEncoding.Default.GetBytes(user.password);  
  3. Byte[] originalBytes = System.Text.Encoding.ASCII.GetBytes(user.password);  
  4. Byte[] encodedBytes = md5.ComputeHash(originalBytes);  
  5. user.password = BitConverter.ToString(encodedBytes);  
  6. StringBuilder user_password_main = new StringBuilder();  
  7. for (int i = 0; i < encodedBytes.Length; i++)  
  8. {  
  9. user_password_main.Append(encodedBytes[i].ToString("X2"));  
  10. }  
above code OUTPUT is : 4DE53544234ADFFBB421ED60FFCFB835 but i dont want this type generate password.
 
i want to generate password like this:
 
$2y$40$yIei8lieo8hOvqAsERTzyeuU.g.0y6aaJagKGL.ZZYPr0oSdB.GDx
 
using MD5.

Answers (2)