public void MD5HashToPass_1() { string expected = "D41D8CD98F00B204E9800998ECF8427E"; string md5HashResult = HashingTools.MD5Hash(""); Assert.AreEqual(expected, md5HashResult); }
// Returns a string representing the input API Key, but in a salted (using input salt) and hashed form. private string HashAndSaltAPIKey(string unsalted_unhashed_api_key, string salt) { // Salted API Key = First five character of Salt + Key + Remaining Characters of Salt string salted_api_key = salt.Substring(0, 5) + unsalted_unhashed_api_key + salt.Substring(5); // Return the MD5 hash of the salted password. return(HashingTools.MD5Hash(salted_api_key)); }
public void MD5HashToPass_2() { string toHash = "let it rock let it roll let it go"; string expected = "A0C7DA379F081624DD1AE00762969BCD"; string md5HashResult = HashingTools.MD5Hash(toHash); Assert.AreEqual(expected, md5HashResult); }
// Returns a string representing the password, but in a salted (using input salt) and hashed form. public static string HashAndSaltPassword(string unsalted_unhashed_password, string salt) { // Salted Password = First three characters of Salt + Password + Remaining Characters of Salt string salted_password = salt.Substring(0, 3) + unsalted_unhashed_password + salt.Substring(3); // Return the MD5 hash of the salted password. return(HashingTools.MD5Hash(salted_password)); }