Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Encryption of a field in VFP 5
Message
From
23/09/1998 07:34:01
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
23/09/1998 06:58:52
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00139739
Message ID:
00139742
Views:
24
>I have a need to encrypt, at table level, a single field of that table, a password login. Could anybody offer a suggestion as to the best way to do this, it would be very much appreciated.
>
>Thank you
Brendan,
In files section (classes or win32 ?) there is cipher*.fll. You could encypt input with it and save. Later you could decrypt field content to compare with input. Also you could save checksum value too (sys(2007)) to add more security. This one is a simple encrpytor/decryptor routine (not good and not fast to use with memos) :
lparameters cInString, cKey 
local cRetStr, ix, cTlen, xLen
cRetStr = ""
cTLen = len(cInString)
xLen = len(cKey)
for ix = 1 to cTlen
	cRetStr = cRetStr + ;
		chr(bitxor( ;
		asc(substr(cInstring,ix,1)),;
		asc(substr(cKey,(ix-1)%xLen+1,1))))
endfor
return cRetStr
Sample usage of encrypted field :
* Passw checker

if !seek(thisform.txtName.value+;
  Encrypt(ThisForm.txtPassw.value,thisform.cKey),;
  "PwdTable","Namepwd")
  messagebox("Password not confirmed !")
  ...
else
 ....
endif

* Passw saver
insert into pwdTable (Name,Pwd) ;
  values (thisform.txtName.value, ;
  Encrypt(ThisForm.txtPassw.value,thisform.cKey))
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform