C# method to convert a byte array to a hex string.
/// <summary>
/// Converts byte array into a hex string
/// </summary>
public static String ConvertToHexString(byte[] bytes)
{
var sb = new StringBuilder();
for (int i = 0; i < bytes.Length; i++)
{
sb.Append(bytes[i].ToString("x2"));
}
return sb.ToString();
}