Page 2 of 2

Re: Hide literal strings in compiled exe

Posted: Sat May 14, 2011 4:03 am
by kenmo
D'oh, I missed the post where you mentioned you already wrote a pre-processor. Sorry!

It would be an interesting feature... (But, realistically, it would be pretty low on the PB team's list of priorities in the near future!)

Re: Hide literal strings in compiled exe

Posted: Sat May 14, 2011 9:52 am
by em_uk
Hi,

I sometimes need to hardcode stuff into an executable I dont want someone to easily be able to view, I do this :

Code: Select all

;needs Droopy Lib for SelfEncryption

Procedure.s PassToHex(passworda$="data",enc=#True)
  If enc
    tbufa$=SelfEncryption(passworda$,#True)
    passworda$=tbufa$
    tlen=Len(passworda$) : loc = 0
    tbuf$="" : loc = 0 
    For n = 0 To tlen-1
      loc=@passworda$+n
      result$= RSet(Hex(PeekB(loc)),2,"0")
      tbuf$+result$      
    Next    
    SetClipboardText("key$="+#DQUOTE$+tbuf$+#DQUOTE$)    
    ProcedureReturn tbuf$       
  Else    
    tlen=Len(passworda$)
    tbuf$=""
    For n= 0 To tlen
      n=n+1
      loc=@passworda$+n
      bufa$=Mid(passworda$,n,2)
      result$=Chr(Val("$"+bufa$))
      tbuf$+result$    
    Next
    tbufa$=SelfEncryption(tbuf$,#False)    
    ProcedureReturn tbufa$
  EndIf
EndProcedure

; create me an encoded key

key$="This Key will be stored"

Debug "Encrypted"

Debug PassToHex(key$,#True) ; the encoded key will be copied to clipboard as key$="xxxx" etc.

; decode me some key
    
key$="432B4231115A3F466611781478583A5F7F0C7817656501" 

Debug PassToHex(key$,#False)

MessageRequester("Test", PassToHex(key$,#False))

Any determined hacker could easily use olydbg to figure this out though, but it keeps most people out.

Cheers

Re: Hide literal strings in compiled exe

Posted: Thu May 19, 2011 11:39 pm
by DoubleDutch
+1 for some way of doing this.