Wow? You post that and I was on that page less then a half hour ago. I find all kinda places that are more then willing to do the Magic Number even show the assembly code just like the program Kayacker posted but no one was doing a given the magic number give me the original number? Then it hit me wait if I put the magic number in then it will spit back the original? ( http://www.hackersdelight.org/magic.htm ) Well this works for lots of numbers like 5, 13 etc... But here is my code
Code:
Address Hex dump Command Comments
0046214A |. B8 555555D5 MOV EAX,D5555555
0046214F |. F7EE IMUL ESI
00462151 |. C1FA 02 SAR EDX,2
00462154 |. 8BC2 MOV EAX,EDX
00462156 |. C1E8 1F SHR EAX,1F
00462159 |. 03C2 ADD EAX,EDX
0046215B |. 8D0440 LEA EAX,[EAX*2+EAX]
0046215E |. 8D34C6 LEA ESI,[EAX*8+ESI]
00462161 |. 8BD9 MOV EBX,ECX
00462163 |. 83E1 0F AND ECX,0000000F
00462166 |. 83C1 F9 ADD ECX,-7
00462169 |. 894C24 18 MOV DWORD PTR SS:[LOCAL.9],ECX
0046216D |. 894C24 24 MOV DWORD PTR SS:[LOCAL.6],ECX
Which seems much more complex then
Code:
MagicNumber = 3616814565
mov eax,X
mov edx, MagicNumber
inc eax
mul edx
SHR edx, 4
I'm really interested in figuring out how DFFFFFFF is found and what this would have looked like before the compiler optimization?
And why can't I find a table with these anywhere? I feel like I should take one of these programs and generate a table with it?
Bookmarks