Can cookie store non-ascii?

P

Paul W

Hi - I'm doing simple XOR encryption on a password before storing it in a
cookie. I use the same 2-way encryption/decryption routine at each end
(before writing/after reading). Something is getting screwed up because this
doesn't work as expected. Can cookies store any non-ascii characters? (I'm
thinking that maybe this limitation is what is screwing me up). Thanks,

(I've confirmed that the 2-way encryption using the following routine does
work correctly)

Paul.

-----------
Private Function cryptUserDetails(ByVal strTemp As String) As String
'Encrypts or decrypts a string. This encryption is a simple XOR based on
'a random seed number. Passing the encrypted string will decrypt it, passing
'the unencrypted string will decrypt it. Returns a blank string on error.
'Instring= the string to work with
'KeyValue=the seed value (MUST BE POSITIVE)
Dim X As Integer
Dim KeyValue As Integer
Dim singlechar As String
Dim charnum As Integer
Dim randomint As Integer
Dim OutString As String
Dim i As Integer, Seed As Single

On Error GoTo EncryptError
KeyValue = 133 'Len(strTemp) * 13 'psw addition
OutString = ""
Seed = Rnd(-KeyValue)
For i = 1 To Len(strTemp)
singlechar = Mid$(strTemp, i, 1)
charnum = Asc(singlechar)
randomint = CInt(256 * Rnd())
charnum = charnum Xor randomint
singlechar = Chr(charnum)
OutString = OutString + singlechar
Next i
cryptUserDetails = OutString
Exit Function
EncryptError:
'Encryption error; return a blank string
cryptUserDetails = ""
Exit Function
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top