5
Esta es una pregunta similar a this one here.Función incorporada para convertir de bytes a cadena hexadecimal
¿Hay un método incorporado que convierta una matriz de byte a cadena hexadecimal? Más específicamente, estoy buscando un sistema incorporado en función de
/// <summary>
/// Convert bytes in a array Bytes to string in hexadecimal format
/// </summary>
/// <param name="Bytes">Bytes array</param>
/// <param name="Length">Total byte to convert</param>
/// <returns></returns>
public static string ByteToHexString(byte[] Bytes, int Length)
{
Debug.Assert(Length <= Bytes.GetLength(0));
StringBuilder hexstr = new StringBuilder();
for (int i = 0; i < Length; i++)
{
hexstr.AppendFormat("{0,02:X}", Bytes[i]);
}
hexstr.Replace(' ', '0'); //padd empty space to zero
return hexstr.ToString();
}
+1 escribió este código exacto ... –