上传者: fengtaotao2011
|
上传时间: 2022-05-17 09:00:14
|
文件大小: 3KB
|
文件类型: JAVA
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);
}
}