这个加密程序的ABC是哪来的?固定的?还是有别的函数随机生成,然后双方互相告知的?听说加密解密都是这个函数是么?有大神了解么。。@xyz549040622 @dirtwillfly
Const unsigned uint32_t M1 =A;
Const unsigned uint32_t IA1 =B;
Const unsigned uint32_t IC1 =C;
Void encrypt(uint32_t key, unsigned char* buffer, uint32_t size )
{
uint32_t idx = 0;
if( 0 = = key )
{
key = 1;
}
uint32_t mkey = M1;
if (0 = = mkey )
{
mkey = 1;
}
while( idx < size )
{
key = IA1 * ( key % mkey ) + IC1;
buffer[idx++] ^= (unsigned char)((key>>20)&0xFF);
}
}
|