DEFINE CLASS cpassword AS tools OF tools.vcx crawpassword = "" cencpassword = "" cEncKey = "" nEncType = 2 nEncMode = 0 FUNCTION init() IF NOT "vfpencryption.fll" $ LOWER(SET("Classlib")) SET LIBRARY TO vfpencryption.fll ENDIF ENDFUNC FUNCTION newpassword() LOCAL LCRET this.crawpassword = "PWD"+SYS(3)+SYS(2015) this.cencpassword = this.encrypt(this.crawpassword) RETURN this.crawpassword ENDFUNC FUNCTION isEncryptEd(tcPassword) LOCAL llRet llRet = LEN(CHRTRAN(UPPER(tcPassword)," 1234567890ABCDEFGHIJKLMNOPQRSTUVWZYX_","")) > 0 return llRet ENDFUNC FUNCTION Conv_encrypt(tcPassword) LOCAL lcRet lcRet = "" IF NOT EMPTY(tcPassword) AND VARTYPE(tcPassword) = "C" lcRet = this.encrypt(tcPassword) lcRet = STRCONV(lcRet,15) ENDIF return lcRet ENDFUNC FUNCTION encrypt(tcPassword) LOCAL lcRet lcRet = encrypt(tcPassword,this.cEncKey,this.nEncType,this.nEncMode) return lcRet ENDFUNC FUNCTION Conv_decrypt(tcPassword) LOCAL lcRet lcRet = "" IF NOT EMPTY(tcPassword) AND VARTYPE(tcPassword) = "C" lcRet = STRCONV(tcPassword,16) lcRet = this.Decrypt(lcRet) ENDIF return lcRet ENDFUNC FUNCTION Decrypt(tcPassword) LOCAL lcRet lcRet = decrypt(tcPassword,this.cEncKey,this.nEncType,this.nEncMode) lcRet = CHRTRAN(lcRet,CHR(0),"") return lcRet ENDFUNC ENDDEFINE>Hi all,
>UPDATE SomeTable SET EncField = BinaryGobbledygook WHERE PK = 123 >>
>UPDATE SomeTable SET EncField = 'BinaryGobbledygook' WHERE PK = 123 >>