public String getHashValue(String input) { String str = new SecretHash().secretHashMethod(input); String output = String.Copy(str); return(output); }
public Boolean AuthenticateUserCredential(String userName, String passWord) { bool authenticate = false; string fLocation = Path.Combine(location + fileName); if (System.IO.File.Exists(fLocation) && userExists(userName)) { SecretHash hash = new SecretHash(); String passwordHash = hash.getHashValue(passWord); FileStream fStream = new FileStream(fLocation, FileMode.Open); XmlDocument doc = new XmlDocument(); doc.Load(fStream); fStream.Close(); XmlNodeList nodeList = doc.SelectNodes("/credentials/user/username"); foreach (XmlNode node in nodeList) { if (node.InnerText.Equals(userName) && node.NextSibling.InnerText.Equals(passwordHash)) { authenticate = true; } } } return(authenticate); }