需要帮助将vb转换为javascript [英] Need help convert vb to javascript

查看:59
本文介绍了需要帮助将vb转换为javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  function  encode(tmpMessage)

Dim alpha,crypt,encMessage,x,i

encMessage =
alpha = abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`1234567890 - =] [;。,〜!@#$%^ & *()_ + |} {:?><
crypt = `= - ] [;。,〜!@#$%^& *()_ + |} {:?>< 1092837456qazwsxedcrfvtgbyhnummikolpQAZWSXED CRFVTGBYHNUJMIKOLP

for x = 1 to len (tmpMessage)
for i = 1 to len(alpha)
如果 mid(tmpMessage,x, 1 )= mid(alpha,i, 1 然后
encMessage = encMessage + mid(crypt,i, 1
退出 for
elseif i> = len(alpha)然后
encMessage = encMessage + mid(tmpMessage,x, 1
end if
next
encode = encMessage
next

结束 功能

解决方案

%^& *()_ + |} {:?><
crypt = `= - ] [;。,〜!@#

%^& *()_ + |} {:?>< 1092837456qazwsxedcrfvtgbyhnummikolpQAZWSXED CRFVTGBYHNUJMIKOLP

for x = 1 len(tmpMessage)
i = 1 len(alpha)
如果 mid(tmpMessage,x, 1 )= mid(alpha,i, 1 然后
encMessage = encMessage + mid(crypt,i, 1
退出
elseif i> = len(alpha)然后
encMessage = encMessage + mid(tmpMessage,x, 1
结束 如果
next
encode = encMessage
next

结束 function


这是一个简单的替换密码[不是真正的加密!],它将在不到10分钟内被破解......

话虽如此。这是不完整的JS代码:



for(x = 1; x< tmpMessage.length; x ++){//对于每个char输入文本

for(i = 1; i< alpha.length; i ++){

if substring(tmpMessage,x,1)= substring(alpha,i,1){

encMessage = encMessage + substring(crypt,i,1)//将char替换为相应的crypt char

}

}

}


function encode(tmpMessage)

   Dim alpha,crypt,encMessage,x,i

   encMessage=""
     alpha="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ `1234567890-=][;.,~!@#$%^&*()_+|}{"":?><"
     crypt="`=-][;.,~!@#$%^&*()_+|}{"":?><1092837456qazwsxedcrfvtgbyhnujmikolpQAZWSXED CRFVTGBYHNUJMIKOLP"

     for x = 1 to len(tmpMessage)
         for i = 1 to len(alpha)
           if mid(tmpMessage,x,1)=mid(alpha,i,1) then
            encMessage=encMessage+mid(crypt,i,1)
            exit for
           elseif i>=len(alpha) then
            encMessage=encMessage+mid(tmpMessage,x,1)
           end if
         next
         encode = encMessage
     next

End function

解决方案

%^&*()_+|}{"":?><" crypt="`=-][;.,~!@#


%^&*()_+|}{"":?><1092837456qazwsxedcrfvtgbyhnujmikolpQAZWSXED CRFVTGBYHNUJMIKOLP" for x = 1 to len(tmpMessage) for i = 1 to len(alpha) if mid(tmpMessage,x,1)=mid(alpha,i,1) then encMessage=encMessage+mid(crypt,i,1) exit for elseif i>=len(alpha) then encMessage=encMessage+mid(tmpMessage,x,1) end if next encode = encMessage next End function


This is a simple substitution cypher [not real encryption!] which will be cracked in less than 10 minutes...
Having said that. Here's the incomplete JS code:

for (x = 1; x < tmpMessage.length; x++) { //for each char input text
for (i = 1; i < alpha.length; i++) {
if substring(tmpMessage, x, 1) = substring(alpha, i, 1) {
encMessage = encMessage + substring(crypt, i, 1) //replace the char with the corresponding crypt char
}
}
}


这篇关于需要帮助将vb转换为javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆