能力值:
( LV4,RANK:50 )
|
-
-
2 楼
#include <stdio.h>
#include <ctype.h>
#include <time.h>
#include <stdlib.h>
int __stdcall myCRC(unsigned char * chBuf)
{
int out = 0;
for ( int i = 0; i < 8; ++i )
{
if ( isalpha(chBuf[i]) )
out = (out<<4) + chBuf[i] - 55;
else
out = (out<<4) + chBuf[i] - 48;
}
return out;
}
unsigned char* __stdcall myValue(unsigned int ival, unsigned char* outbuf, int rann = 30)
{
int out = 0, i = 0;
int tival = ival;
for (i=8; i>0; i--)
{
unsigned int tmpval = tival + 55;
unsigned char tv = (tmpval&0xF);
tmpval = tmpval>>4;
tv = tv + (((tmpval&0xF)-rann)<<4);
if (isalpha(tv))
{
outbuf[i-1] = tv;
}
else
{
outbuf[i-1] = tv - 7;
}
tival = (tival+55-outbuf[i-1])>>4;
}
if ( ival != myCRC(outbuf) )
{
// 如果不行,换一个key
return myValue(ival, outbuf, rann+1);
}
return outbuf;
}
int main(int argc, char* argv[])
{
unsigned char buf[8] = {0};
srand(time(NULL));
for (int i=0; i<999999; i++)
{
for (int j=0; j<8; j++)
{
buf[j] = rand()&0xFF;
}
int vv = myCRC(buf);
myValue(vv, buf);
if (myCRC(buf) != vv)
{
printf("No OK!\n");
}
}
return 0;
}
|
能力值:
(RANK:110 )
|
-
-
3 楼
感谢大牛!
|
能力值:
( LV2,RANK:10 )
|
-
-
4 楼
http://www.21ic.com/tools/HotWC3_V1.11.html
HotWC3最大的特点是有可逆运算!!!
很少见有可逆的CRC运算器。
|
|
|