Used to convert a byte array to its hex equivalent.
originally written by: RuE
Code
public static string ByteToHexString(byte[] p)
{
char[] c = new char[p.Length * 2 + 2];
byte b;
c[0] = '0'; c[1] = 'x';
for (int y = 0, x = 2; y < p.Length; ++y, ++x)
{
b = ((byte)(p[y] >> 4));
c[x] = (char)(b > 9 ? b + 0x37 : b + 0x30);
b = ((byte)(p[y] & 0xF));
c[++x] = (char)(b > 9 ? b + 0x37 : b + 0x30);
}
return new string(c);
}originally written by: RuE
If You Like this tutorial,
please check out my other tutorials by clicking ==> here
please check out my other tutorials by clicking ==> here
PHP & .NET Contributor.

