Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!think.com!paperboy!hsdndev!cmcl2!adm!news From: ZCCBJSB%EB0UB011.BITNET@cunyvm.cuny.edu (Josep Sau B.) Newsgroups: comp.lang.pascal Subject: Store password in exe file Message-ID: <26530@adm.brl.mil> Date: 11 Apr 91 08:14:41 GMT Sender: news@adm.brl.mil Lines: 43 Going on with passwords, Cathy Anderson says: >I had written one myself ...! I have it so it reads the password >from a file and it can be changed without the code. >The problem is that I need an external file (which can be typed so >you can get an idea of the password). What about encrypting the password written to that file? This way a curious may TYPE it to see its contents but that won't help much him/her to know the password... This may be a very simple function to do this: (* written from scratch, no syntax check *) FUNCTION Crypt (pw:Password) :Password; {-Encrypts or Decrypts-} CONST Key : $99; {-any 8 bits mask -} VAR i :INTEGER; BEGIN FOR i := 1 TO LENGTH(pw) DO pwi! := CHAR(BYTE(pwi! XOR Key)); Encrypt := pw; END; You have to read the crypted password from the file, filter it thru a simmilar function, and try to match it with user entered password. >Anyway, what I want to know is if there is a way so that this >password can be included in the .EXE file so I don't have to >have another file and I don't need the code to change it. There is a package in TRICKLE server called PCKSELFM.ZIP in directory . It shows a simple way to add non-static data to the end of an EXE file. It speaks about configuration info and the like, but it can be used to store a password. --Josep Sau B. '...and he amazed with the marvels that are in the world, and he asked about things he did not understand, and he taught about things he knew.' Raimundus Lulius - _Llibre_de_Meravelles_