I translated a VB6 module containing a couple of encryption functions into c#, I have the following aritmethic operation in both sides:
C#:
int inter, cfc;
inter = 6940;
cfc = Convert.ToInt32((((inter / 256) * 256) - (inter % 256)) / 256);
//cfc = 26
VB6:
Dim inter As long
Dim cfc As long
inter = 6940
cfc = (((inter / 256) * 256) - (inter Mod 256)) / 256
'cfc = 27
I haven't been able to figure out the result mismatch since all operations are returning integer numbers, this is causing the encryption process to work unexpectedly.