public string CalculateHash(string text) { MD5 md5 = new MD5CryptoServiceProvider(); //compute hash from the bytes of text md5.ComputeHash(ASCIIEncoding.ASCII.GetBytes(text)); //get hash result after compute it byte[] result = md5.Hash; StringBuilder strBuilder = new StringBuilder(); for (int i = 0; i < result.Length; i++) { //change it into 2 hexadecimal digits //for each byte strBuilder.Append(result[i].ToString("x2")); } return strBuilder.ToString(); } public api_login Validate2(string userName, string Password) { // Find a user that matches that username and password (this will only validate if both match) return db.api_login.FirstOrDefault(u => u.username == userName && u.password == Password); }
SHA512
SHA256
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)