能力值:
( LV2,RANK:10 )
|
-
-
2 楼
此算法不可逆
|
能力值:
( LV2,RANK:10 )
|
-
-
3 楼
不会吧
|
能力值:
( LV6,RANK:90 )
|
-
-
4 楼
int MyFileSize = 32; unsigned char MyFileBuf[TestMyFileSize] = { "1234567890123456789012345678901" }; int EncryptTest() { for (int i = 0; i < TestMyFileSize; i++) { MyFileBuf[i] = (MyFileBuf[i] << 4) + (MyFileBuf[i] >> 4); MyFileBuf[i] = MyFileBuf[i] ^ 0x20; } return 0; }
|
能力值:
( LV5,RANK:60 )
|
-
-
5 楼
MyFileBuf[i]=((MyFileBuf[i]&0x0F)*16+(MyFileBuf[i]&0xF0)/16)^0x20;
|
能力值:
( LV2,RANK:10 )
|
-
-
6 楼
heone
int MyFileSize = 32;
unsigned char MyFileBuf[TestMyFileSize] = { "12345678901234567890123 ...
3L OK!!谢谢 , 谢谢大家~ 问题解决了
|
能力值:
( LV13,RANK:357 )
|
-
-
7 楼
# 异或,字节高低位交换都是完全可逆的, 代码交换一下计算流程就好了
int DecryptTest()
{
for (int i = 0; i < TestMyFileSize; i++)
{
MyFileBuf[i] = (MyFileBuf[i] << 4) | (MyFileBuf[i] >> 4);
MyFileBuf[i] = MyFileBuf[i] ^ 0x20; //上下行交换一下
}
return 0;
}
|
能力值:
( LV2,RANK:10 )
|
-
-
8 楼
( (X^0x20) (<<4) ) + ( (X^0x20) (>>4) ) = Y // 加密 // Sammer推导 1、 ( X (^0x20) )( (<<4) + (>>4) ) = Y 2、 ( X (^0x20) ) = Y( (<<4) + (>>4) ) ====>> (X (^0x20) ) = (Y<<4)+ (Y>>4) 3、 ( (Y<<4) + (Y>>4) ) (^0x20) = X // 解密
加的括号都有意义,临时变量、立即数对运算符的一些规律
|
|
|