Click to See Complete Forum and Search --> : File Name Encryption and Decryption


Slickwilly9
08-26-2008, 04:25 PM
I found a function which will encrypt and decrypt a string, however, it uses all ascii values. I need it to only allow a-z, 0-9 and A-Z. The function is below. I am not locked into this function, so if there is another way I am good with that too. Thanks.

Seth

<%
Function CryptVBS(Text, Key)
KeyLen = Len(Key)
For i = 1 To Len(Text)
KeyPtr = (KeyPtr + 1) Mod KeyLen
sTxtChr = Mid(Text, i, 1)
wTxtChr = Asc(stxtchr)
wKeyChr = Asc(Mid(Key, KeyPtr + 1, 1))
CryptKey = Chr(wTxtChr Xor wKeyChr)
hold = hold & CryptKey
Next
CryptVBS = hold
End Function
%>