### PLZ Help me with a HARD algorithm

greenspun.com : LUSENET : reverse engineering : One Thread

hello...

I have one problem while i crack a program...

Seems like the program convert your code to another code with this TYPE:

My code is (supposed): abcdefgh (it has to be eight letters)

later the program construct the MAGIC NUMBER to:

(a*1)+(b*10)+(c*100)+(d*1000)+(e*10000)+(f*100000)+(g*1000000)+(h*10000000)

and later compare the result with the real CODE (encrypted with the same algorithm..)

But my question is: How can i reverse the MAGIC real Number to normal !!!!!

HELP ME!

-- John (noelia12@yahoo.com), April 30, 1998

I was never very good at math, but if you want to brute force the algorithm you can write something like int a, b, c, d, e, f, g, h; int RealCode, TempCodea-h; for (h = 48, h < 123, h++) { TempCodeh = RealCode - (h*10000000); for (g = 48, g < 123, g++){ TempCodeg = TempCodeh - (g*1000000); ...etc..etc.. for (a = 48, a < 123, a++) { TempCodea = TempCodeb - a; If TempCodea > 0 { printf( "%c,%c,%c,%c,%c,%c,%c,%c\n", a,b,c,d,e,f,g,h); } } ...etc... }

============ OK, yeah this is crude coding and probably a little off, but hey I'm in a hurry ;)

_m

-- mammon_ (m@m.com), April 30, 1998.

Thanx a lot for the answer Mammon!!!!!!

I never could do that!!!..

is mt ENOUGH the code you wrote me???? Do i need to fill something else? (apart of Etc.i supposed what is it)

Best reggards.... AND THANKS AGAIN For YOUR Valious HELP!!

You do a GOOD JOB for THE UNIVERSE!!!!

-- john (noelia12@yahoo.com), April 30, 1998.

Sorry for the formatting of the code...

It should work, though you may want to do conditionals after each subtraction (i.e., Tempcodeh=RealCode-(h*10000000); if Tempcodeh > 0 then for-g-loop, etc...) so that you don't waste any more time than necessary. Also, the for loops assume you are adding the decimal values of ascii characters (0-z, per my DOS manual) so you may need to do some hex conversion, it depends on the algorithm.

It also assumes you have the encrypted real value (it sounds like you do) and are trying to work backwards to the unecrypted real value. As I said, I am by no means an encryption or mathematical specialist, but this coding should work backwards from the encrypted value and give you a number (possibly a very large number, but hey that's brute force, eh?) of potential answers. And it will take a long time to run.

But it's better than nothing. If you try it or an alternate and it works, by all means post it here

_m

-- mammon_ (m@m.com), April 30, 1998.

Err I think you just repetatively divide the magic number by 10, the remainder at each stage is the next character of the code.

Things screw up if the magic number overflowed and was truncated when it was generated - I think you would get a different but still valid code.

-- spyder (ssspyder@hotmail.com), May 02, 1998.