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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Encrypt and Decrypt data 1

Status
Not open for further replies.

JNC73

Technical User
Jan 8, 2001
65
NL
Hi,

Can anyone tell me if there is a standard solution to encrypt and decrypt data in VFP?
I need to encrypt all data in local DBF files and decrypt them when I show the data in the application and before sending it to a SQL*Server database.

Thnx,

JNC73
 
if you've got vfp7

C:\Program Files\Microsoft Visual FoxPro 7\Samples\Solution\Ffc\Crypto.scx

they provide a sample

mrF
 
I've got VFP5
Does this also have the same solution?
 
The Crypto API interface was first provided in VFP 7.0.

One freeware solution to encryption is the CryptPak by Milan Kosina ( Another is CIPHER50.FLL based on work by Tom Rettig and available at the UT ( in the Download area.

Of course, if you are only encrypting fields you can always "roll your own" - high powered encryption schemes are severely crippled when you use short data strings, so your algorithm will probably be just as "secure".

Rick
 
roll your own...

here's on i knocked up earlier - very basic & doesn't work if you have foreign (circumflexed, acute, grave) accented characters in the data.

paste it into a prg, modify & play

IF !USED("dealer")
USE c:\dealer.dbf IN 0 ALIAS dealer
ENDIF

AFIELDS(myarr)
FOR x=1 TO ALEN(myarr,1)
IF ALLTRIM(myarr(x,2))="C"
REPLACE ALL &myarr(x,1) WITH defunc(&myarr(x,1))
endif
endfor


*******************************************
function enfunc(cToencrypt)

content=""

FOR e=1 to LEN(cToencrypt)
m.ch = SUBSTR(cToencrypt,e,1)
IF ASC(m.ch) < 123
Content = Content + CHR(ASC(m.ch)+100)
ELSE
Content = Content + m.ch
ENDIF
NEXT

return content


*******************************************
function defunc(cTodecrypt)

content=&quot;&quot;

FOR e=1 to LEN(cTodecrypt)
m.ch = SUBSTR(cTodecrypt,e,1)
IF ASC(m.ch) > 123
Content = Content + CHR(ASC(m.ch)-100)
ELSE
Content = Content + m.ch
ENDIF
NEXT

return content

MrF
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top