jtt809加密算法

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);
}
}

你可能感兴趣的:(jtt809加密算法)