把vbscript转换为javascript
解决时间 2021-04-23 18:46
- 提问者网友:兔牙战士
- 2021-04-23 00:41
请各位大哥把vbscript转换为javascript
<script language="vbscript" runat="server">
Function EnHttp(strCryptThis,g_Key)
dim I_N_L,I_N,EnHttpKeyChar,EnHttpStringChar
I_N_L=csng(Len(strCryptThis))
for I_N = 1 to I_N_L
EnHttpKeyChar = Asc(mid(g_Key,I_N,1))
EnHttpStringChar = Asc(mid(strCryptThis,I_N,1))
EnHttpCryptChar = EnHttpKeyChar Xor EnHttpStringChar
if I_N mod 2 = 0 then
strEncrypted = strEncrypted & EnHttpCryptChar+5
else
strEncrypted = strEncrypted & EnHttpCryptChar-5
end if
if csng(I_N)<>csng(I_N_L) then strEncrypted = strEncrypted & "."
next
EnHttp = strEncrypted
End Function
Function DeHttp(strEncrypted,g_Key)
Dim strChar, DeHttpKeyChar, DeHttpStringChar, I_N,I_N_L
strEncrypted=split(strEncrypted,".")
I_N_L=csng(ubound(strEncrypted))
for I_N = 0 to I_N_L
DeHttpKeyChar = (Asc(mid(g_Key,csng(I_N+1),1)))
if I_N mod 2 = 0 then
DeHttpStringChar = strEncrypted(I_N)+5
else
DeHttpStringChar = strEncrypted(I_N)-5
end if
DeHttpDeCryptChar = DeHttpKeyChar Xor DeHttpStringChar
strDecrypted = strDecrypted & Chr(DeHttpDeCryptChar)
next
DeHttp = strDecrypted
End Function</script>
最佳答案
- 五星知识达人网友:琴狂剑也妄
- 2021-04-23 01:10
document.write(
'<script language="vbscript" runat="server">' +
'Function EnHttp(strCryptThis,g_Key)' +
'dim I_N_L,I_N,EnHttpKeyChar,EnHttpStringChar' +
'I_N_L=csng(Len(strCryptThis))' +
'for I_N = 1 to I_N_L' +
'EnHttpKeyChar = Asc(mid(g_Key,I_N,1))' +
'EnHttpStringChar = Asc(mid(strCryptThis,I_N,1))' +
'EnHttpCryptChar = EnHttpKeyChar Xor EnHttpStringChar' +
'if I_N mod 2 = 0 then' +
'strEncrypted = strEncrypted & EnHttpCryptChar+5' +
'else' +
'strEncrypted = strEncrypted & EnHttpCryptChar-5' +
'end if' +
'if csng(I_N)<>csng(I_N_L) then strEncrypted = strEncrypted & "."' +
'next' +
'EnHttp = strEncrypted' +
'End Function' +
'Function DeHttp(strEncrypted,g_Key)' +
'Dim strChar, DeHttpKeyChar, DeHttpStringChar, I_N,I_N_L' +
'strEncrypted=split(strEncrypted,".")' +
'I_N_L=csng(ubound(strEncrypted))' +
'for I_N = 0 to I_N_L' +
'DeHttpKeyChar = (Asc(mid(g_Key,csng(I_N+1),1)))' +
'if I_N mod 2 = 0 then' +
'DeHttpStringChar = strEncrypted(I_N)+5' +
'else' +
'DeHttpStringChar = strEncrypted(I_N)-5' +
'end if' +
'DeHttpDeCryptChar = DeHttpKeyChar Xor DeHttpStringChar' +
'strDecrypted = strDecrypted & Chr(DeHttpDeCryptChar)' +
'next' +
'DeHttp = strDecrypted' +
'End Function</script>' +
'');
我要举报
大家都在看
推荐资讯