jtt809加密算法

来源:互联网 发布:陕西水利预算软件 编辑:程序博客网 时间:2024/06/07 14:07
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);
}
}
0 0