News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Different "Case Switch"

Started by theunknownguy, March 17, 2010, 05:14:27 PM

Previous topic - Next topic

theunknownguy

Hi again, i need some help.

I got 2 projects and the main one is a security system for games, i mostly done all that it "could be done" without slowing down the performance of the game or been "too invasive".

Among many features i got for protecting agaisnt dissamblers that will try to ofcourse bypass the protection. Is a system between client and server with encrypted packets (Serpent algo).

But when the game receive the packet i do a serveral checks till pass into the main protocol "parser".

My question is to anyone that know how do different types of "Case Switch". Here i put the common one:

Movsx ecx, Byte Ptr [Eax + CaseCode]
Jmp DWord Ptr [Ecx * 4 + jmpTable]


If you have other way to do this, please post it...

I hope i havent done anything agaisnt the rules of forum  :green

clive

Well when the switch/case is sparse it can be done with compare/branch chains, alternatively a binary search method using compare/branch(es).

If the list is sparse but clustered, you can use a combination of compare/branch and jump tables.

-Clive
It could be a random act of randomness. Those happen a lot as well.

theunknownguy

I am using now a compare/branch chains in obfuscated method they look alot of confusing and doesnt waist much clocks...

I will try a binary search in obfuscated mode seems alot more better or probably a convo between the two.

Thanks you