hex2bin

char *bin2hex(unsigned char *buff,int size)
{
	char tab[16]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
	char *dest = (char *)malloc(size * 2 + 1);
	for (int i = 0 ;i < size;i++)
	{
		dest[i*2] = tab[buff[i]>>4];
		dest[i*2+1] = tab[buff[i] & 0x0F];
	}
	dest[size * 2] = 0;
	return dest;
}

你可能感兴趣的:(hex2bin)