lcUserID = "MyUserID" lcPassword = "MyPassword" lcUIDDigest = MD5Hash(lcUserID) lcPWDigest = MD5Hash(lcPassword) * Above two values can be embedded in your app as variables or constants, * written to table fields etc. * Check if user is authorized: * lcKeyedUserID, lcKeyedPassword are values that user keys in when your program starts IF MD5Hash(lcKeyedUserID) = lcUIDDigest ; AND MD5Hash(lcKeyedPassword) = lcPWDigest * Authorized ELSE * Not authorized - retry, kick 'em out, etc. ENDIFFor implementation of MD5, check out Re: Hash() Function in VFP Thread #713481 Message #714561
>* Get the cipher50.fll file from the below url: >* http://www.levelextreme.com/wconnect/wc.dll?FournierTransformation~2,54,33,9222 > >IF NOT 'CIPHER50' $ UPPER(SET('library')) > SET LIBRARY TO cipher50.fll >ENDIF > >lcText = "ABA" >lcEncryptKey = "Whateveryoulike" > >? "Base Value: ", lcText >? " Encrypted: ", encrypt(lcText, lcEncryptkey) >? " UnEncrypt: ", encrypt(encrypt(lcText, lcEncryptkey), lcEncryptKey) >>
>>> >>>* Get FoxCrypto.FLL at http://www.connectthenet.com/foxpro/FoxCrypto.fll >>> >>> >>>SET LIBRARY TO FoxCrypto.FLL >>>LOCAL lnHandle >>>CLEAR >>>lcBuffer = "Testing" >>>? " Base Value: ", lcbuffer >>> >>>lnHandle = Base64encoderCREATE( .F. ) >>>IF lnHandle > 0 >>> Base64encoderPUT(lnHandle, lcBuffer) >>> Base64encoderCLOSE(lnHandle) >>> lnSize = Base64encoderMaxRetrievable(lnHandle) >>> lcBase64Encoded = Base64encoderGET(lnHandle, lnSize) >>> ? "Encrypted Value: ", lcBase64encoded >>> Base64encoderDestroy(lnHandle) >>>ENDIF >>> >>>lnHandle = Base64decoderCREATE() >>>IF lnHandle > 0 >>> Base64decoderPUT(lnHandle, lcBase64encoded) >>> Base64decoderCLOSE(lnHandle) >>> lnSize = Base64decoderMaxRetrievable(lnHandle) >>> lcBase64decoded = Base64decoderGET(lnHandle, lnSize) >>> ? "Decrypted Value: ", lcBase64decoded >>> Base64decoderDestroy(lnHandle) >>>ENDIF >>>? "Matches = ", lcBase64decoded == lcBuffer >>> >>>>>>