#include <stdio.h>
#include<stdlib.h>
#include<string.h>
static unsigned char byte_char_sw_hex( unsigned char ucCharacter )
{
if( ( ucCharacter >= '0' ) && ( ucCharacter <= '9' ) )
{
return ( unsigned char )( ucCharacter - '0' );
}
else if( ( ucCharacter >= 'a' ) && ( ucCharacter <= 'f' ) )
{
return ( unsigned char )( ucCharacter - 'a' + 0x0A );
}
else if( ( ucCharacter >= 'A' ) && ( ucCharacter <= 'F' ) )
{
return ( unsigned char )( ucCharacter - 'A' + 0x0A );
}
else
{
return 0xFF;
}
}
/*
函数功能:十六进制转换为字符串
org:输入的十六进制数组
len:数组长度
out:返回结果
*/
void hex_sw_str(unsigned char *org, int len, unsigned char *out)
{
int i =0;
int idx=0;
char str[]="0123456789ABCDEF";
while(i<len) {
unsigned char tmp[2] = "