Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HOW TO ENCRYPT CONTENT OF PRG FILE 4

Status
Not open for further replies.

COBART

MIS
Sep 7, 2000
33
0
0
ID
HALLO ....

I HAVE APPLICATION WITH PRG AND SCX FILE
I WANT TO ENCRYPT MY PROGRAM FOR SAFETY MY SOURCE PROGRAM
CAN YOU GIVE ME CODE FOR ENCRYPT AND UN-ENCRYPT MY SOURCE PROGRAM.
mY SOURCE PROGRAM IS *.PRG AND *.SCX *.SCT FILE


THANKS FOR ATTENTION

COBART
 
If it compiled into an exe, you don't need to distrubute the prg file, just the exe. That way there is no need to encrypt the prg.
 
In the Project menu choose Project Info and check Encrypted.
Now EXE-files can't be reverse-engineerd.

 
NO ! NO THAT I MEAN

I NEED TO ENCRYPT MY PROGRAM, BECAUSE I WANT TO HIDE FROM ANYBODY CAN READ MY PROGRAM
 
COBART

If you need to distribute you prg file, then no, I don't think it's possible to encrypt your prg.
May I ask why you are distributing your uncompiled source code?
And please refrain from using uppercase letters, it means you are screaming, and I don't think that is your intention.
 
Cobart,
The simple answer is to create a project of your program and form, and them build the .EXE with the Project encrypt option on (and debug off). This will make it impossible for someone with just a file viewer from reading your code.

Unfortunately, there are programs (like Xitech's ReFox and others) that can decompile this encrypted file back into the original code - although with no comments.

There are also software "wrapper" programs that might make it even more difficult to decompile, but NO program can't be hacked given the time, resources and the right incentive to do it. (Note: Yesterday's announcement that someone has broken MS's "foolproof" routine on it's XBox, and now it's may be possible to run Linux on it!
Rick
 
Rick, that sounds horrible - what is the best "wrapper"-program for VFP at the moment?
And have you any experience how the performance will be influenced by such a program?

Regards from Germany

Klaus
 
Well it turns out that the "best" program to prevent decompiling is ReFox itself. They offer a branding utility and depending on the level you choose, it adds additional code to the your .EXE and/or changes your runtime files.
There is very little no virtually no performance hit depending on the level choosen. Note: This highest level can make it difficult if you have multiple VFP programs on a single system, unless you encrypt them all the same. And of course if you are just one supplier of VFP software you can run into conflicts!

Last, even these variants can reportedly be decompiled with a pirated reverse engineered version of ReFox that is available from sources in China.

Rick
 
Rick, a simple manner to "hide" your code is put in a ZIP file with a password. That manner, you can put all your .prgs safe and other type of files too.
JLucio
 
I wrote these 2 small routines (they are generic, but they work) to encrypt any (ascii file) (that you could open in a word editor)

Func Encrypt()
LOCAL Enc_File,Enc_Key
CLEAR
Enc_File = GETFILE("PRG") && in your case prgs!
IF EMPTY(Enc_File) OR !FILE(Enc_File)
MESSAGEBOX("Sorry file does not exist or You did not select a file",16,"Invalid")
RETURN
ENDIF
Enc_key = VAL(INPUTBOX("Enter an Encryption Key Value","Value","40"))
IF EMPTY(Enc_Key)
Enc_Key = 32 && by default
ENDIF
nHandle = fopen(Enc_File,2)
nLength = fseek(nHandle,0,2)
=fseek(nHandle,0)
cString = fread(nHandle,nLength)
w = ""
WAIT WINDOW "Encrypting File, please wait... " NOWAIT
for x = 1 to len(cString)
* c = ltrim(str(x))
HeadIn = ltrim(str(asc(substr(cString,x,1))))
HeadOut = chr(val(HeadIn) + Enc_key)
w =w+HeadOut
next x

fseek(nHandle,0,0)

MESSAGEBOX(iif(fwrite(nHandle,w,nlength) = 0,ferror(),"File Encrypted Successfully!"))
fclose(nHandle)

***********
Function Decrypt()
LOCAL Enc_File,Enc_Key
CLEAR
Enc_File = GETFILE("PRG")
IF EMPTY(Enc_File) OR !FILE(Enc_File)
MESSAGEBOX("Sorry file does not exist or You did not select a file",16,"Invalid")
RETURN
ENDIF
Enc_key = VAL(INPUTBOX("Enter an Encryption Key Value","Value","40"))
IF EMPTY(Enc_Key)
Enc_Key = 32 && by default
ENDIF
nHandle = fopen(Enc_File,2)
nLength = fseek(nHandle,0,2)
=fseek(nHandle,0)
cString = fread(nHandle,nLength)
WAIT WINDOW "Decrypting File, please wait... " NOWAIT
w = ""
for x = 1 to len(cString)
c = ltrim(str(x))
HeadIn = ltrim(str(asc(substr(cString,x,1))))
HeadOut = chr(val(HeadIn) -Enc_Key)
w =w+HeadOut
next x
=fseek(nHandle,0)
if fwrite(nHandle,w,nlength) = 0
MESSAGEBOX("Error has occured: "+ ferror())
ELSE
MESSAGEBOX("File has been decrypted with Key Code: " + LTRIM(STR(Enc_Key)))
ENDIF
fclose(nHandle)


I just tried it on 2 prgs, and 5 txt files... And it worked!!
Let me know what you think!! Plz, I am curious!!! Please let me know if this helped you :)

Tekno
Wireless Toyz
Ypsilanti, Michigan
 
by the way, I never tested the above codes on a large scale (text or prg file)

Please let me know if this helped you :)

Tekno
Wireless Toyz
Ypsilanti, Michigan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top