Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Native VFP Encryption Code
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01294514
Message ID:
01294578
Views:
19
>Anyone have a native VFP encryption/decryption class I can have?

Hi

Hope this work :)
Function encrypx(mstring,mcryp)
If Vartype(mcryp) <> 'C'
	mcryp = 'mypass'
Endif
If ISNULL(mstring) OR empty(mstring)
	retval = ''
ELSE
	Local lenstr,lencry,retval,lchaval,lcnxt,aaa
	retval = ''
	lcnxt = 0
	aaa = 0
	lenstr = Len(Alltrim(mstring))
	lencry = Len(Alltrim(mcryp))
	For aaa = 1 To lenstr
		If lcnxt > lencry
			lcnxt = 1
		Else
			lcnxt = lcnxt+1
		Endif
		retval = retval + Chr(Asc(Substr(mstring,aaa,1))+Asc(Substr(mcryp,lencry,1)))
	Endfor
Endif
Return retval

Function decrypx(mstring,mcryp)
If Vartype(mcryp) <> 'C'
	mcryp = 'mypass'
ENDIF
If Isnull(mstring) OR empty(mstring)
	retval = ''
ELSE
	Local lenstr,lencry,retval,lchaval,lcnxt,aaa
	retval = ''
	lcnxt = 0
	aaa = 0
	lenstr = Len(Alltrim(mstring))
	lencry = Len(Alltrim(mcryp))
	For aaa = 1 To lenstr
		If lcnxt > lencry
			lcnxt = 1
		Else
			lcnxt = lcnxt+1
		Endif
		retval = retval + Chr(Asc(Substr(mstring,aaa,1))-Asc(Substr(mcryp,lencry,1)))
	Endfor
Endif
Return retval
Previous
Reply
Map
View

Click here to load this message in the networking platform