RC4 加密算法asp版

 Function RC4(data, Key)
Dim s(), k(), outstr, Acii, j, tst, xre1, xre2, temp, x, t, y, qwe, zxc
For i = To
s(i) = i -
Next
j =
For i = To
dex = dex +
If j > Len(Key) Then
j =
End If
Acii = Asc(Mid(Key, j, ))
If Acii < Then
tst = Hex(Acii)
xre1 = Mid(tst, , )
xre2 = Mid(tst, , )
k(i) = Int("&H" & xre1)
k(i + ) = Int("&H" & xre2)
i = i +
Else
k(i) = Acii
End If
j = j +
Next
j =
For i = To
j = (j + s(i) + k(i)) Mod +
temp = s(i)
s(i) = s(j)
s(j) = temp
Next
j =
For i = To Len(data)
x = (x + ) Mod +
j = (j + s(x)) Mod +
temp = s(x)
s(x) = s(j)
s(j) = temp
t = (s(x) + s(j) Mod ) Mod +
y = s(t)
Acii = Asc(Mid(data, i, ))
If Acii < Then
tst = Hex(Acii)
qwe = qwe +
If qwe >= Then
zxc = Int("&H" & Mid(tst, , ))
qwe =
Else
zxc = Int("&H" & Mid(tst, , ))
i = i -
End If
Else
zxc = Acii
End If
outstr = outstr & Bitsor(zxc, y)
Next
RC4 = outstr
End Function Function Bitsor(x, y)
Dim Mx, Hx, Wx
Mx =
Hx =
Wx =
Mx = x And y
Mx = Mx *
Hx = Hex(X + y - Mx)
If Len(Hx) > Then
Wx = Hx
Else
Wx = "" & Hx
End If
Bitsor = Wx
End Function
上一篇:Nginx反向代理服务器


下一篇:SpringMVC+Spring+hibernate整合及分页