A C# RSS Feed Retriever Sample

Home » C# Projects » A C# RSS Feed Retriever Sample
C# Projects No Comments

A C# RSS Feed Retriever Sample

Version Compatibility: C#

More information:
This snippet calculates the MD5 has of a given string and optionally accepts the encoding type to use. The method is overloaded so you only have to pass in a string to hash, and the system encoding default is used instead.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

public static string CalculateMD5Hash(string UserInput, Encoding EncodingToUse)
{
    System.Security.Cryptography.MD5CryptoServiceProvider CryptoService;
    CryptoService = new System.Security.Cryptography.MD5CryptoServiceProvider();
 
    byte[] InputBytes = EncodingToUse.GetBytes(UserInput);
    InputBytes = CryptoService.ComputeHash(InputBytes);
    return BitConverter.ToString(InputBytes).Replace("-", "");
}
 
public static string CalculateMD5Hash(string UserInput)
{
    // This is just a call to the base method above
    return CalculateMD5Hash(UserInput, System.Text.Encoding.Default);
}

LEAVE A COMMENT