I'd like to store the hash of a password on the phone, but I'm not sure how to do it. I can only seem to find encryption methods. What's the best way to hash the password?
UPDATE: THIS ANSWER IS SERIOUSLY OUTDATED. Please use the recommendations from the http://stackoverflow.com/a/10402129/251311 instead.
You can either use
var md5 = new MD5CryptoServiceProvider(); var md5data = md5.ComputeHash(data);
var sha1 = new SHA1CryptoServiceProvider(); var sha1data = sha1.ComputeHash(data);
data as byte array you could use
var data = Encoding.ASCII.GetBytes(password);
and to get back string from
var hashedPassword = ASCIIEncoding.GetString(md5data);