/// <summary> /// Hashes a string that is url encoded as output. /// </summary> /// <param name="s">Input string</param> /// <returns>Hashed string with url encoding</returns> public static string UrlHash(string s) { // Can't encrypt empty strings if (s == null) return ""; // Tansform the string into a byte array byte[] hash = encoder.GetBytes(s); // Hash the password with SHA512 hash = shaHasher.ComputeHash(hash); // Return as BASE64 string HTMLSanitizer hs = new HTMLSanitizer(); string dummy = hs.UrlEncode(Convert.ToBase64String(hash)); return dummy.Replace('%', '1'); }