thefool's obfuscation routine :(

Bare metal programming in PureBasic, for experienced users
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

thefool's obfuscation routine :(

Post by rsts »

No longer works in PB5b5 x86 (enable inline asm)

Code: Select all

Macro osR(w,msk,shft)
  ((w & msk) >> shft)
EndMacro
Macro osL(w,msk,shft)
  ((w & msk) << shft)
EndMacro
Procedure ob_obsfucate_sillier(mem.l, sz.l, skip.l = #False)
    Protected i.l, wk.l
    Protected *ps.byte
   
    Goto oc
    ooa:
    wk = *ps\b & $FF
    ;return to ba
    Goto ba
    oc:
   
    myooa = ?ooa
    Goto ob
    begin:
   
    For i = 1 To sz
        PUSH myooa
        ;do some stuff?
        RET
        ba:
       
        Goto ooo3
        ;do the *ps+1
        orpa:
        *ps + 1
        Goto ooo4
        ooo3:
       
       
        ;do
        Goto a1
        r2:
        Goto a2
        r3:
        Goto a3
        a2:
        teos|(osR(wk, $08, 3) | osL(wk, $01, 3) | osR(wk, $04, 1))
        Goto r3:
        a1:
        teos = osR(wk, $C0, 2) | osL(wk, $30, 2)
        Goto r2
        a3:
        teos|(osL(wk, $02, 1))
       
        *ps\b = teos
       
        PUSH l_orpa  ;=======ERROR============
        RET
        ooo4:
       
       
    Next
   
    Goto oa
    ob:
    *ps = mem
    Goto begin
    oa:
   
EndProcedure

Code: Select all

---------------------------
PureBasic - Assembler error
---------------------------
PureBasic.asm [448]:

MP0

PureBasic.asm [229] MP0 [140]:

PUSH l_orpa

error: undefined symbol 'l_orpa'.


---------------------------
OK   
---------------------------
assistance please :)
User avatar
Shield
Addict
Addict
Posts: 1021
Joined: Fri Jan 21, 2011 8:25 am
Location: 'stralia!
Contact:

Re: thefool's obfuscation routine :(

Post by Shield »

Change it to PUSH l_ob_obsfucate_sillier_orpa. :)
Image
Blog: Why Does It Suck? (http://whydoesitsuck.com/)
"You can disagree with me as much as you want, but during this talk, by definition, anybody who disagrees is stupid and ugly."
- Linus Torvalds
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Re: thefool's obfuscation routine :(

Post by rsts »

Shield wrote:Change it to PUSH l_ob_obsfucate_sillier_orpa. :)
:D

cheers
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Re: thefool's obfuscation routine :(

Post by rsts »

And with PB5.2b7 things have changed once again :(

PUSH myooa = syntax error.

every new release brings a new set of challenges :)
User avatar
Danilo
Addict
Addict
Posts: 3037
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: thefool's obfuscation routine :(

Post by Danilo »

rsts wrote:And with PB5.2b7 things have changed once again :(

PUSH myooa = syntax error.

every new release brings a new set of challenges :)
Just put "EnableASM" in front of the code, or put EnableASM / DisableASM combination within the procedure.
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Re: thefool's obfuscation routine :(

Post by rsts »

Whoops :oops:
Thought compiler options took care of that.

Many thanks. :)
Fred
Administrator
Administrator
Posts: 16686
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: thefool's obfuscation routine :(

Post by Fred »

It did before the update, but it is now removed as it was redundant with the compiler directive.
User avatar
Tenaja
Addict
Addict
Posts: 1949
Joined: Tue Nov 09, 2010 10:15 pm

Re: thefool's obfuscation routine :(

Post by Tenaja »

For those wanting to use this with Unicode, you need to replace the Len() arguments in the obfuscation calls with StringByteLength(). Otherwise it only does the first half, since Unicode is 2-bytes per char.

Another alternative would be mod the code to work on a character level, rather than a byte level...but clearly, more work.
Post Reply