using System;
using System.Text;
public class Program
{
public static void Main()
var b = new byte[] {94, 85, 60, 64, 62, 69, 77, 65, 131, 20, 125, 110, 136, 128, 87, 112};
var c = "0x" + ByteArrayToString(b);
Console.WriteLine(c);
var result = Convert.ToBase64String(Encoding.UTF8.GetBytes(c));
Console.WriteLine(result);
}
// Adapted from here: https://stackoverflow.com/a/311179/3043
public static string ByteArrayToString(byte[] ba)
StringBuilder hex = new StringBuilder(ba.Length * 2);
foreach (byte b in ba)
hex.AppendFormat("{0:X2}", b);
return hex.ToString();