Looks like you've got your solution. Another way to approach this in VFP is to take the ciphertext returned and convert it to hexBinary using STRCONV() and then reverse the process when decrypting. This way the database is only holding a hex representation of the cipertext, the drawback being that the ciphertext takes up twice as many bytes.
>Thanks Vladimir,
>
>This seems to work. The interesing part is the VarBinary() column comes back as a memo so the cast( varchar()) must be automatic.
>
>
>>James,
>>You can use
>>
>>INSERT INTO YourTable (PasswordField) VALUES (CAST('asd' AS VarBinary(200))
>>and reverse
>>
SELECT CAST(PasswordField AS VarChar(200)) from YourTable where ...
>>
>>James,
>>I like CA,
>>but IMO you need again use binary, varbinary or image data type in SQL.
>>
>>
>>>Thanks Vladimir,
>>>
>>>I am using varchar(200) and I was afraid that was the problem. I am using SPT and I have not found a way to work with the binary type. I guess I will have to switch this table to CA.
>>>
>>>Thanks again.
>>>
>>>>>Hi all,
>>>>>
>>>>>I am using Craig Boyd's vfpencryption.fll to encrypt passwords and save them in a SQL type database. It seems that once in a while I have a problem that one or more of the characters that the fll creates will not work and the update gets rejected. I tried to copy the update statement into ISQL and half of the password screen was truncated. Is there a way to make the work and still be able to decrypt the password?
>>>>>
>>>>>Tahnks for your help.
>>>>
>>>>Hi James,
>>>>What Data Type is your column in SQL for passwords ? Use binary type.
>>>>
>>>>HTH