>>>>>Hi,
>>>>>
>>>>>I am using cipher() function to encrypt a long string (250 char). Then I need to store the encrypted value into a field of a SQL Server table. Can the field be type CHAR(250)? or it must be NCHAR(250)?
>>>>>
>>>>>TIA
>>>>
>>>>I would ditto on Naomi, it should be binary, unless you also convert it to base64 encoded value. Otherwise, you are in danger of losing data, be it char or nchar. BTW cipher() function, what is that? I only assumed it was something doing encryption using one the known algorithms.
>>>
>>>Yes, cipher() is a function that does encryption. Sergey Berezniker converted it from C to VFP some many years ago. I don't know who wrote the original (C-version) of this function.
>>
>>Is that a special encryption algorithm that never return non-printable characters and also with an exact size? If so you can use char(N). nchar() uses unicode.
>>
>>If it might return a non-printable character and size is not fixed (both case are the usual cases with encryption algorithms) then varbinary(N) or varbinary(MAX) is the choice. You might instead use varchar(Max), provided you are converting the value to base64 encoded - StrConv(encrypted, 13).
>
>I don't know the answers to these questions. Here is an example of the encrypted string:
>
>xvneoUNC7ùêæĵ˜†]T>"Ûͪ“m|+ 缨pMöûžjBÓ±zIǼw9öŒKÐ¥RÌw¾q)ЗOý²PÇlûtÊs)¿f¯|ï•-ÎX§8ÖJ‰;Çgé| ™µEÏVîfëpíX‘‡3ø{÷\ç[ÕHð4ˆËhÒ@³+…èW¿‡ïO¬>nË(ŠÕ>œòK‘õLŠäg„ð$kúe¿ç‚ÕM£ÄQ†éT–¸Õ*rƒßØ's¯¯s"Í–ŸsSÖÂ¥‚bq"êÏ㻆iwp-=ÔôÃج“¸´Šƒ«—–mo\
>
please pronounce that slowly.