ACSII码表
1 ACSII码表2 instance analysis实例分析(实践应用)
1 ACSII码表
2 instance analysis实例分析(实践应用)
#include <stdio.h>
#define SN_COUN 9
#define SIZE_32 32
static unsigned int const sn_info
[16][8] =
{
{'0', 'p',' ', '0' , '@', 'P', ' ', 'p'},
{'1', 'Q','!', '1' , 'A', 'Q', 'a', 'q'},
{'2', 'R','"', '2' , 'B', 'R', 'b', 'r'},
{'3', 'S','#', '3' , 'C', 'S', 'c', 's'},
{'4', 'T','$', '4' , 'D', 'T', 'd', 't'},
{'5', 'U','%', '5' , 'E', 'U', 'e', 'u'},
{'6', 'V','&', '6' , 'F', 'V', 'f', 'v'},
{'7', 'U',' ', '7' , 'G', 'W', 'g', 'w'},
{'8', 'V','(', '8' , 'H', 'X', 'h', 'x'},
{'9', 'X',')', '9' , 'I', 'Y', 'i', 'y'},
{'a','Y','*', ':' , 'J', 'Z', 'j', 'z'},
{'b','Z','+', ';' , 'K', '[', 'k', '{'},
{'c','[',',', '<' , 'L', ' ', 'i', '|'},
{'d',' ','-', '=' , 'M', ']', 'm', '|'},
{'e','6','.', '>' , 'N', '^', 'n', '~'},
{'f','-','/', '?' , 'O', '_', 'o', ' '}
};
int get_sn_number(char *sn_str
,int length
, char *str_dst
)
{
char sn_number
[SN_COUN
] = {0};
memcpy(sn_number
, sn_str
, length
);
int sn_x
[SIZE_32
] = {0};
int sn_y
[SIZE_32
] = {0};
int i
= 0;
for(i
= 0 ; i
< SN_COUN
; ++i
)
{
sn_y
[i
] = (sn_number
[i
] & 0x0f);
sn_x
[i
] = (sn_number
[i
] & 0xf0) >> 4;
printf("x:%x y:%x\n",sn_x
[i
], sn_y
[i
]);
}
printf("x:%x y:%x\n",sn_x
[0], sn_y
[0]);
char SN_NUMBER
[SIZE_32
] = {0};
i
= 0;
printf("SN: ");
for(i
= 0 ; i
< SN_COUN
; i
++)
{
SN_NUMBER
[i
] = sn_info
[sn_y
[i
]][sn_x
[i
]];
printf("<%c> (addr:%x%x) ",SN_NUMBER
[i
], sn_y
[i
], sn_x
[i
]);
}
printf(" \n");
printf("sn_number:%s\n",SN_NUMBER
);
memcpy(str_dst
, SN_NUMBER
, length
);
return 0;
}
int main()
{
char getnumber
[32] = {0};
char sn_str
[32] = {0x4b, 0x55, 0x32, 0x42, 0x33,0x32,0x31,0x72,0x99,0x00,0x00};
get_sn_number(sn_str
, SN_COUN
, getnumber
);
printf("getnumber:%s\n", getnumber
);
return 0;
}
转载请注明原文地址: https://lol.8miu.com/read-21156.html