Exetools

Exetools (https://forum.exetools.com/index.php)
-   General Discussion (https://forum.exetools.com/forumdisplay.php?f=2)
-   -   Crypto or not? (https://forum.exetools.com/showthread.php?t=5874)

Mkz 11-26-2004 22:56

Quote:

Originally Posted by volodya

while(carac2!=0)
{
carac2 = carac2 + resultat[cpt3] ; (1)
resultat[cpt3] = carac2 % 100 ; (2)
carac2 = carac2 div 100 ; (3)
cpt3++ ;
}


Are you sure you did it well?
carac2 = carac2 div 100 - I'm assuming I see the division, rigth? Then go study math - the division will never give you 0 (in the integers ring) - and you check for 0 in while loop - endless cycle.

There's something here I don't understand...
Let's assume carac2 enters the loop with 1000.
After line 1, let's say 1050.
Line 2 will produce 50, line 3 will produce 10.
In the second iteration, line 1 might give 67 (added 57 this time), line 2 = 57, line 3 = ..... 0.

Each iteration adds a (small) amount to carac2, then shifts it right by 2 decimal places, eventually resulting in 0. Does it not?
:confused:

volodya 11-27-2004 00:05

In the second iteration, line 1 might give 67 (added 57 this time), line 2 = 57, line 3 = ..... 0.

DAMN... DAMN... DAMN ONE MORE TIME. It is me who should go and study comp.sci. This is the integer arithmetic... Fuck.

OK,
carac2 = carac2 + resultat[cpt3] ; (1) - you say, for example, carac2 will be 67. OK. Fine.
Then:
resultat[cpt3] = carac2 % 100 ; (2)
the operation "%" in C/C++ is the same as mod in number theory.
So, 67 mod 100 = 67 - not 57 as you are trying to say if I understood you properly, of course...
Then:
carac2 = carac2 div 100 -> carac2 = 67/100 - this is normally not 0, of course, BUT this is computer arithmetic and the result is rounded up, so it will be floor(67/100) which is 0 indeed. So you are partially right and I'm wrong. My bad.

Mkz 11-29-2004 18:42

Of course line (2) will result in 67, my mistake :D
67 % 100 -> 67
67 / 100 -> 0 (integer)

Now one other strange thing in the algo - where do the "resultat[cpt3]" values come from?


All times are GMT +8. The time now is 02:48.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX