Page 1 of 1

I need to obfuscate (encode-decode) some large string

Posted: Tue Mar 29, 2005 4:36 am
by ricardo
Hello

I need to obfuscate (encode-decode) some large string to make it unreadable if someone rightclick my .exe.
But its large, very large (2 pages of a javascript).

Need to be able to read itself the .exe and decode it. Dont want to use well know methods but some custom ones (to make harder the decode by curios)... any suggestion?

Thanks in advance.

Posted: Tue Mar 29, 2005 5:21 am
by ricardo
ATM im using this idea:

Code: Select all

Procedure.s Encode(string$,Nn)
    For Char = 1 To Len(string$)
        Letra$ = Mid(string$,Char,1)
        EncNum+1
        Codificado$ = Codificado$ + Chr(Asc(Letra$) + EncNum)
        If EncNum > Nn
            EncNum = 0
        EndIf
    Next
    ProcedureReturn Codificado$
EndProcedure

Procedure.s Decode(string$,Nn)
    For Char = 1 To Len(string$)
        Letra$ = Mid(string$,Char,1)
        EncNum+1
        Codificado$ = Codificado$ + Chr(Asc(Letra$) - EncNum)
        If EncNum > Nn
            EncNum = 0
        EndIf
    Next
    ProcedureReturn Codificado$
EndProcedure

It works, but dont know if my idea is primitive, there are better ones, etc.

The point is that not alwasy letter 'A' will replaced by the same on the encoded string. I know this can be hacked, but im just doing this for hidde the code, not for avoiding professional hackers, just avoid curios people.

Then, hello world, hello world, hello world encoding with Nn as 3, gets igopp"zssng0!jhpmq#{ptoh-"kimnr$xqupe and encoding it with Nn as 19 gets igopt&~w{vo8-vt|}

Posted: Tue Mar 29, 2005 5:36 am
by ricardo
This could be better:

Code: Select all

Procedure.s Encode(string$,Nn,Added)
    For Char = 1 To Len(string$)
        Letra$ = Mid(string$,Char,1)
        EncNum+Added
        Codificado$ = Codificado$ + Chr(Asc(Letra$) + EncNum)
        If EncNum > Nn
            EncNum = 0
        EndIf
    Next
    SetClipboardText(Codificado$)
    ProcedureReturn Codificado$
EndProcedure

Procedure.s Decode(string$,Nn,Added)
    For Char = 1 To Len(string$)
        Letra$ = Mid(string$,Char,1)
        EncNum+Added
        Codificado$ = Codificado$ + Chr(Asc(Letra$) - EncNum)
        If EncNum > Nn
            EncNum = 0
        EndIf
    Next
    ProcedureReturn Codificado$
EndProcedure
Using Nn as 19 and Added as 2
hello world, hello world, hello world becomes:
jirty,…„€f0&poxz2‹qvrl6,vu~€q$}w|xr

Using Nn as 19 and Added as 3
hello world, hello world, hello world becomes:
kkux~2Œrxup;2}hru{/‰„urm8/zzorx,†

Posted: Tue Mar 29, 2005 5:40 am
by freak
I think a very simple way would be to use the packer commands to compress the data.
The result is absolutely unreadable, and you even save some bytes :)