-
-
[旧帖]
[求助]高手请进,加密算法。
0.00雪花
-
发表于:
2008-5-31 22:33
2675
-
[旧帖] [求助]高手请进,加密算法。
0.00雪花
下面是一个字符串加密的源代码? unsigned char *buff这个已经加密的串存放位置。请问如何通过*buff内容计算出原字符串myString里面内容?
unsigned int indexOfBuffer =0;
unsigned int temp2 =0;
unsigned int temp4 =5;
unsigned char *buff;
void main()
{
unsigned char myString[] ={"avfdcrftgrgfrftrfg"};
buff = new unsigned char [sizeof(myString)];
{Initialize the buffer}
for(int i =0;i<sizeof(myString-1),i++)
{
putCode(buff,myString[i]);
}
}
int putCode(unsigned char *buff, unsigned char code)
{
int temp = 0;
if(8-temp2 > temp4)
{
unsigned int temp = code;
temp &= 0xFF;
temp <<= temp2;
temp |= buff[indexOfBuffer];
buff[indexOfBuffer] = temp;
temp2 += temp4;
}else
{
temp = 8 - temp2;
if(temp !=0)
{
unsigned int x = code;
x &= 0xFF;
x <<= temp2;
x &= 0xFF;
x |= buff[indexOfBuffer];
buff[indexOfBuffer] = x & 0xff;
}
temp2 =0;
indexOfBuffer++;
unsigned int y = code;
y >>= temp;
buff[indexOfBuffer] = y;
temp2 += temp4 - temp;
}
return 1;
}
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课