Research/Source Repository
[C#] array byte to hex string
cheesechoi
2014. 6. 18. 16:15
static string Hex2Str(array<byte> b){
char * c = new char(b.GetLength()*2+2);
byte a;
c[0]='0';
c[1]='x';
for(int i=0, j=0; i<b.GetLength(); i++, j++)
{
a = ((byte) (b[i]>>4));
c[j] = (char)( a>9 ? a+0x37:a+0x30);
a= ((byte) (b[i]&0x0f));
c[++j] = (char) (a>9?a+0x37:a+0x30);
}
return c;
}