帮忙把VB6代码改成ASP代码 20

PublicFunctionEncode(ByValSAsString,ByValkeyAsString)AsStringOnErrorGoToerrIfLen(S)=0... Public Function Encode(ByVal S As String, ByVal key As String) As String
On Error GoTo err
If Len(S) = 0 Then Exit Function
Dim Buff() As Byte
Buff = StrConv(S, vbFromUnicode)
Dim i As Long
Dim j As Byte
Dim k As Byte, m As Byte
Dim mstr As String
mstr = key
Dim outs As String
i = UBound(Buff) + 1
outs = Space(2 * i)
Dim Temps As String
For i = 0 To UBound(Buff)
Randomize Time
j = CByte(5 * (Math.Rnd()) + 0) '
Buff(i) = Buff(i) Xor j
k = Buff(i) Mod Len(mstr)
m = Buff(i) \ Len(mstr)
m = m * 2 ^ 3 + j
Temps = Mid(mstr, k + 1, 1) + Mid(mstr, m + 1, 1)
Mid(outs, 2 * i + 1, 2) = Temps
Next
Encode = outs
Exit Function
err:

End Function
展开
 我来答
tonkeys
2010-11-12 · TA获得超过1513个赞
知道大有可为答主
回答量:2087
采纳率:33%
帮助的人:2436万
展开全部
asp里vbs数据类型太弱,建议直接在VB里改成ActiveX在asp中引用,这样简单可靠。
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式